|
|
@@ -297,11 +297,14 @@ 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 } = req.query
|
|
|
+ const { no_laporan, pt_id, jadwal, evaluasi, aktif, delegasi, all } =
|
|
|
+ req.query
|
|
|
if (no_laporan) where.no_laporan = no_laporan
|
|
|
if (pt_id) where['pt.id'] = pt_id
|
|
|
if (aktif) where.aktif = aktif === 'true'
|
|
|
- if (delegasi) where.delegasi = delegasi === 'true'
|
|
|
+ if (all) where.all = true
|
|
|
+ else if (delegasi) where.delegasi = delegasi === 'true'
|
|
|
+
|
|
|
if (jadwal === 'true') {
|
|
|
where.jadwal = {
|
|
|
$exists: true,
|
|
|
@@ -326,10 +329,11 @@ exports.getAll = handleError(async (req, res) => {
|
|
|
exports.getOne = handleError(async (req, res) => {
|
|
|
const { id } = req.params
|
|
|
const user = req.user
|
|
|
- const { aktif, delegasi } = req.query
|
|
|
+ const { aktif, delegasi, all } = req.query
|
|
|
const where = {}
|
|
|
if (aktif) where.aktif = aktif === 'true'
|
|
|
- if (delegasi) where.delegasi = delegasi === 'true'
|
|
|
+ if (all) where.all = true
|
|
|
+ else if (delegasi) where.delegasi = delegasi === 'true'
|
|
|
const data = await cekSatuDataLaporan(res, user, id, where)
|
|
|
if (!data) return
|
|
|
return response.success(res, {
|