yazid138 3 жил өмнө
parent
commit
96e575f4ad

+ 6 - 1
controller/laporan.controller.js

@@ -301,7 +301,7 @@ exports.public = handleError(async (req, res) => {
 exports.getAll = handleError(async (req, res) => {
   const user = req.user
   const where = {}
-  const { no_laporan, pt_id, jadwal, evaluasi, aktif, delegasi, all } =
+  const { no_laporan, pt_id, jadwal, evaluasi, aktif, delegasi, all, sanksi } =
     req.query
   if (no_laporan) where.no_laporan = no_laporan
   if (pt_id) where['pt.id'] = pt_id
@@ -322,6 +322,11 @@ exports.getAll = handleError(async (req, res) => {
         $size: 0,
       },
     }
+  } else if (sanksi === 'true') {
+    where.sanksi = {
+      $exists: true,
+      $ne: null,
+    }
   }
   let data = await cekBanyakDataLaporan(user, where)
   return response.success(res, {