|
|
@@ -130,11 +130,8 @@ exports.cekSatuDataSanksi = async (
|
|
|
return sanksi
|
|
|
}
|
|
|
|
|
|
-exports.cekBanyakDataSanksi = async (
|
|
|
- user,
|
|
|
- where = { banding: false, aktif: true }
|
|
|
-) => {
|
|
|
- const w = { aktif: where.aktif || true }
|
|
|
+exports.cekBanyakDataSanksi = async (user, where = { banding: false }) => {
|
|
|
+ const w = {}
|
|
|
switch (user.role.id) {
|
|
|
case 2020:
|
|
|
if (!where.banding) {
|
|
|
@@ -150,14 +147,14 @@ exports.cekBanyakDataSanksi = async (
|
|
|
break
|
|
|
}
|
|
|
let data = await sanksiModel
|
|
|
- .find({ aktif: true, ...where })
|
|
|
+ .find({ aktif: where.aktif || true, ...where })
|
|
|
.populate({
|
|
|
path: 'laporan',
|
|
|
select: 'pt',
|
|
|
match: w,
|
|
|
})
|
|
|
.populate('user')
|
|
|
- .select('-batas_waktu -aktif -dokumen -pelanggaran')
|
|
|
+ .select('-batas_waktu -dokumen -pelanggaran')
|
|
|
.sort({
|
|
|
createdAt: -1,
|
|
|
})
|