yazid138 il y a 2 ans
Parent
commit
ca2599e512
1 fichiers modifiés avec 3 ajouts et 11 suppressions
  1. 3 11
      controller/v1/sanksi.controller.js

+ 3 - 11
controller/v1/sanksi.controller.js

@@ -99,7 +99,6 @@ exports.create = handleError(async (req, res) => {
     sanksi: data._id,
     $push: { step: from_date ? SANKSI : SELESAI },
     flag: from_date ? SANKSI : SELESAI
-    // aktif: false,
   })
   await pemantauanModel.create({
     laporan: laporan._id,
@@ -191,10 +190,8 @@ exports.update = handleError(async (req, res) => {
       sanksi: sanksiBody,
       keterangan,
       dokumen: dokumen_id,
-      masa_berlaku: {
-        from_date,
-        to_date
-      },
+      aktif: from_date ? true : false,
+      masa_berlaku: from_date && to_date ? { from_date, to_date } : null,
       $push: {
         riwayat_sanksi: sanksi
       }
@@ -368,12 +365,7 @@ exports.getAll = handleError(async (req, res) => {
     }
   }
   if (perbaikan === TRUE) {
-    where.$or = [{
-      'jawaban.banding': {
-        $exists: true,
-        $ne: null
-      }
-    }, { is_pengajuan_keberatan: false }, { is_pengajuan_banding: false }]
+    where.perbaikan = { $exists: true, $ne: [] }
   }
   if (delegasi === TRUE) {
     where.delegasi = true