yazid138 3 年之前
父节点
当前提交
2626953fcb
共有 1 个文件被更改,包括 7 次插入5 次删除
  1. 7 5
      utils/cekData.js

+ 7 - 5
utils/cekData.js

@@ -7,10 +7,9 @@ exports.cekSatuDataLaporan = async (
   res,
   user,
   laporan_id,
-  where = { delegasi: false }
+  where = { delegasi: false, aktif: true }
 ) => {
-  const w = { _id: laporan_id, aktif: true, ...where }
-  if (where.aktif === false) w.aktif = false
+  const w = { _id: laporan_id,...where }
   switch (user.role.id) {
     case 2020:
       if (!where.delegasi) w.role_data = 'dikti'
@@ -49,8 +48,11 @@ exports.cekSatuDataLaporan = async (
   return laporan
 }
 
-exports.cekBanyakDataLaporan = async (user, where = { delegasi: false }) => {
-  const w = { aktif: true, ...where }
+exports.cekBanyakDataLaporan = async (
+  user,
+  where = { delegasi: false, aktif: true }
+) => {
+  const w = { ...where }
   if (where.aktif === false) w.aktif = false
   switch (user.role.id) {
     case 2020: