diff --git a/app/controllers/loan.details.controller.js b/app/controllers/loan.details.controller.js index b277f65..6bc96a6 100644 --- a/app/controllers/loan.details.controller.js +++ b/app/controllers/loan.details.controller.js @@ -13,9 +13,9 @@ exports.mainLandingPage = async (req, res) => try { - if(req.query.losid == null) + if(req.query.is_loan_api_call == 0) { - LoanDetail.findAll({raw: true }).then(data => + LoanDetail.findAll({raw: true ,where:{ losid:req.query.losid , is_active : 1}}).then(data => { if(data.length > 0) { @@ -29,10 +29,9 @@ exports.mainLandingPage = async (req, res) => res.send({'status':404, message: err.message || "Some error occurred while retrieving statements." ,'data': "No data" }); }); - }else{ + }else if(req.query.is_loan_api_call == 1){ - Loan_Detail_Losid = await LoanDetail.findOne({ where : { losid : req.query.losid , is_active : 1}}) if (Loan_Detail_Losid == undefined) { @@ -40,8 +39,7 @@ exports.mainLandingPage = async (req, res) => if (ResData.status == "Successful" && ResData.lstLoanApplication.length != 0) { loanDetailData = ResData.lstLoanApplication[0]; - loanDetailObject = - { + loanDetailObject = { applicationNo : loanDetailData.applicationNo, losid : loanDetailData.loginNo , date_of_login : moment(new Date(loanDetailData.loginDate)).format("YYYY-MM-DD"), @@ -55,7 +53,7 @@ exports.mainLandingPage = async (req, res) => //Module Wise Completion Status Data Creation Helper Call ModuleWiseStatusHelper.moduleCompletionStatusDataCreationHelper(loanDetailData.loginNo); // Final Response - LoanDetail.findAll({raw: true , where : { is_active : 1}}).then(data => { if(data.length > 0) { res.send({'status':200,'message':"success",'data':data}); } else { res.send({'status':404,'message':"failed",'data':"No data"}); } }) + LoanDetail.findAll({raw: true , where : {losid :req.query.losid , is_active : 1}}).then(data => { if(data.length > 0) { res.send({'status':200,'message':"success",'data':data}); } else { res.send({'status':404,'message':"failed",'data':"No data"}); } }) // Entity detail promise var EntityKYCDetailDataInsert = new Promise(async(resolve, reject) => @@ -164,8 +162,8 @@ exports.mainLandingPage = async (req, res) => } // end of if lstLoanApplication else { - logMsg.info("Los api call failed Failed " +req.query.losid); - LoanDetail.findAll({raw: true , where : { is_active : 1}}).then(data => + logMsg.info("Los api call Failed " +req.query.losid); + LoanDetail.findAll({raw: true , where : {losid :req.query.losid , is_active : 1}}).then(data => { if(data.length > 0) { @@ -185,7 +183,7 @@ exports.mainLandingPage = async (req, res) => { logMsg.info("Data already inserted " +req.query.losid); // Final Response - LoanDetail.findAll({raw: true , where : { is_active : 1}}).then(data => + LoanDetail.findAll({raw: true , where : {losid :req.query.losid , is_active : 1}}).then(data => { if(data.length > 0) { diff --git a/app/routes/routes.js b/app/routes/routes.js index 6479851..a1cfb94 100644 --- a/app/routes/routes.js +++ b/app/routes/routes.js @@ -2532,6 +2532,13 @@ router.delete("/DeleteTradeReference", Entitycontroller.DeleteTradeReference); * required: true * description: Loan ID * example: MW112233 +* - in: query +* name: is_loan_api_call +* schema: +* type: integer +* required: true +* description: if the value is 1 = Call Loan Detail api , 0 = Don't Call Loan Detail api +* example: 1 * responses: * 200: * description: success