yazid138 преди 3 години
родител
ревизия
20d696ce1e
променени са 2 файла, в които са добавени 5 реда и са изтрити 1 реда
  1. 4 1
      controller/sanksi.controller.js
  2. 1 0
      utils/cekData.js

+ 4 - 1
controller/sanksi.controller.js

@@ -130,7 +130,7 @@ exports.getOne = handleError(async (req, res) => {
   const { sanksi_id } = req.params
 
   const w = {}
-  const { banding, aktif, delegasi } = req.query
+  const { banding, aktif, delegasi, all } = req.query
   if (banding === 'true') {
     w.banding = true
     w['pengajuan.keberatan'] = { $exists: true, $ne: null }
@@ -140,6 +140,9 @@ exports.getOne = handleError(async (req, res) => {
   if (delegasi === 'true') {
     w.delegasi = true
   }
+  if (all === 'true') {
+    w.all = true
+  }
   if (aktif && aktif === 'false') {
     w.aktif = false
   }

+ 1 - 0
utils/cekData.js

@@ -47,6 +47,7 @@ exports.cekSatuDataLaporan = async (
     .findOne(w)
     .populate({ path: 'user', populate: 'foto' })
     .populate({ path: 'pelanggaran', select: 'pelanggaran' })
+    .populate({ path: 'sanksi', populate: ['pelanggaran'] })
     .populate('dokumen')
     .populate({ path: 'evaluasi', populate: ['user', 'dokumen'] })
   // .populate('evaluasi.user')