|
|
@@ -88,7 +88,7 @@ exports.create = handleError(async (req, res) => {
|
|
|
|
|
|
exports.getAll = handleError(async (req, res) => {
|
|
|
const user = req.user
|
|
|
- const { keberatan, jawaban, banding, cabutSanksi, perbaikan, aktif } =
|
|
|
+ const { keberatan, jawaban, banding, cabutSanksi, perbaikan, aktif, delegasi } =
|
|
|
req.query
|
|
|
const where = {}
|
|
|
if (aktif && aktif === 'false') {
|
|
|
@@ -115,6 +115,8 @@ exports.getAll = handleError(async (req, res) => {
|
|
|
}
|
|
|
} else if (perbaikan === 'true') {
|
|
|
where['jawaban.banding'] = { $exists: true, $ne: null }
|
|
|
+ } else if (delegasi === 'true') {
|
|
|
+ w.delegasi = true
|
|
|
}
|
|
|
const data = await cekBanyakDataSanksi(user, where)
|
|
|
return response.success(res, {
|
|
|
@@ -128,13 +130,16 @@ exports.getOne = handleError(async (req, res) => {
|
|
|
const { sanksi_id } = req.params
|
|
|
|
|
|
const w = {}
|
|
|
- const { banding, aktif } = req.query
|
|
|
+ const { banding, aktif, delegasi } = req.query
|
|
|
if (banding === 'true') {
|
|
|
w.banding = true
|
|
|
w['pengajuan.keberatan'] = { $exists: true, $ne: null }
|
|
|
w['jawaban.keberatan'] = { $exists: true, $ne: null }
|
|
|
w['pengajuan.banding'] = { $exists: true, $ne: null }
|
|
|
}
|
|
|
+ if (delegasi === 'true') {
|
|
|
+ w.delegasi = true
|
|
|
+ }
|
|
|
if (aktif && aktif === 'false') {
|
|
|
w.aktif = false
|
|
|
}
|