|
|
@@ -166,9 +166,10 @@ 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 } = req.query
|
|
|
+ const { no_laporan, pt_id, jadwal, evaluasi, aktif } = 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 (jadwal === 'true') {
|
|
|
where.jadwal = {
|
|
|
$exists: true,
|
|
|
@@ -193,7 +194,10 @@ exports.getAll = handleError(async (req, res) => {
|
|
|
exports.getOne = handleError(async (req, res) => {
|
|
|
const { id } = req.params
|
|
|
const user = req.user
|
|
|
- const data = await cekSatuDataLaporan(res, user, id)
|
|
|
+ const { aktif } = req.query
|
|
|
+ const where = { }
|
|
|
+ if (aktif) where.aktif = aktif === 'true'
|
|
|
+ const data = await cekSatuDataLaporan(res, user, id, where)
|
|
|
if (!data) return
|
|
|
return response.success(res, {
|
|
|
message: 'Berhasil ambil data Laporan',
|