From e01b2706f32f63ef470a490e1be8ed0b382e5809 Mon Sep 17 00:00:00 2001 From: Rizki Date: Tue, 10 Mar 2026 10:17:52 +0700 Subject: [PATCH] upd --- adapter/justificationadapter.js | 35 +++++++++++++++++++++++++++++++++ controllers/justification.js | 15 ++++++++++++++ routes/justification.js | 1 + 3 files changed, 51 insertions(+) diff --git a/adapter/justificationadapter.js b/adapter/justificationadapter.js index ef3eeb7..5b161bb 100644 --- a/adapter/justificationadapter.js +++ b/adapter/justificationadapter.js @@ -686,6 +686,41 @@ class JustificationAdapter extends Adapter{ callback('error',apires); } } + + async queryListCheckedAndApprovedBy(req,callback){ + var apires = this.getApiResultDefined(); + try { + + let qry = "select * from vw_checked_and_approved_by order by id asc"; + + // console.log(qry); + db.query(qry,[],function(err,result,fields){ + if(err){ + apires.meta['message'] = err.toString(); + apires.meta['code'] = 500; + callback('err',apires); + } + else + { + if(result.length>0){ + apires.success = true; + apires.data = JSON.parse(JSON.stringify(result)); + } + else{ + apires.meta.code = 200; + apires.meta.message = "Record Not Found"; + } + callback(null, apires); + + } + }); + + } catch (err) { + apires.meta.code = 500; + apires.meta.message = err.toString(); + callback('error',apires); + } + } async queryJustificationDetail(req,callback){ diff --git a/controllers/justification.js b/controllers/justification.js index f633285..57f6641 100644 --- a/controllers/justification.js +++ b/controllers/justification.js @@ -123,6 +123,21 @@ exports.getListApprovedBy = ( req, res ) => { } } +exports.getListCheckedAndApprovedBy = ( req, res ) => { + try{ + justificationadapter.queryListCheckedAndApprovedBy(req,function(err,data){ + let statusCode = data!=null ? data.meta.code : 200 ; + if(err) statusCode = 500; + justificationadapter.sendResponse(statusCode,data, res); + }); + } + catch(err){ + apireshandler.meta.code = 502; + apireshandler.meta.message = " [75] : Justification controller, " + err.toString(); + justificationadapter.sendResponse(502, apireshandler, res); + } +} + exports.deleteJustification = ( req, res ) => { try{ justificationadapter.queryDeleteJustification(req,function(err,data){ diff --git a/routes/justification.js b/routes/justification.js index c39e3dc..13bfc12 100644 --- a/routes/justification.js +++ b/routes/justification.js @@ -10,6 +10,7 @@ router.get('/getlistbudgetrequest',[jwtauth], justificationcontroller.getListBud router.get('/getlistcreatedby',[jwtauth], justificationcontroller.getListCreatedBy); router.get('/getlistcheckedby',[jwtauth], justificationcontroller.getListCheckedBy); router.get('/getlistapprovedby',[jwtauth], justificationcontroller.getListApprovedBy); +router.get('/getlistcheckedandapprovedby',[jwtauth], justificationcontroller.getListCheckedAndApprovedBy); router.post('/setnewjustification',[jwtauth, uploadfile], justificationcontroller.newJustification); router.post('/deletejustification',[jwtauth], justificationcontroller.deleteJustification); router.post('/updatejustification',[jwtauth, uploadfile], justificationcontroller.updateJustification);