loan_detail_api:GWM

This commit is contained in:
sriramv 2023-03-14 09:56:37 +05:30
parent b2e0048e6a
commit bf648b8ac3
2 changed files with 15 additions and 10 deletions

View File

@ -13,9 +13,9 @@ exports.mainLandingPage = async (req, res) =>
try 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) if(data.length > 0)
{ {
@ -29,10 +29,9 @@ exports.mainLandingPage = async (req, res) =>
res.send({'status':404, res.send({'status':404,
message: err.message || "Some error occurred while retrieving statements." ,'data': "No data" }); 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}}) Loan_Detail_Losid = await LoanDetail.findOne({ where : { losid : req.query.losid , is_active : 1}})
if (Loan_Detail_Losid == undefined) if (Loan_Detail_Losid == undefined)
{ {
@ -40,8 +39,7 @@ exports.mainLandingPage = async (req, res) =>
if (ResData.status == "Successful" && ResData.lstLoanApplication.length != 0) if (ResData.status == "Successful" && ResData.lstLoanApplication.length != 0)
{ {
loanDetailData = ResData.lstLoanApplication[0]; loanDetailData = ResData.lstLoanApplication[0];
loanDetailObject = loanDetailObject = {
{
applicationNo : loanDetailData.applicationNo, applicationNo : loanDetailData.applicationNo,
losid : loanDetailData.loginNo , losid : loanDetailData.loginNo ,
date_of_login : moment(new Date(loanDetailData.loginDate)).format("YYYY-MM-DD"), 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 //Module Wise Completion Status Data Creation Helper Call
ModuleWiseStatusHelper.moduleCompletionStatusDataCreationHelper(loanDetailData.loginNo); ModuleWiseStatusHelper.moduleCompletionStatusDataCreationHelper(loanDetailData.loginNo);
// Final Response // 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 // Entity detail promise
var EntityKYCDetailDataInsert = new Promise(async(resolve, reject) => var EntityKYCDetailDataInsert = new Promise(async(resolve, reject) =>
@ -164,8 +162,8 @@ exports.mainLandingPage = async (req, res) =>
} // end of if lstLoanApplication } // end of if lstLoanApplication
else else
{ {
logMsg.info("Los api call failed Failed " +req.query.losid); logMsg.info("Los api call Failed " +req.query.losid);
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) if(data.length > 0)
{ {
@ -185,7 +183,7 @@ exports.mainLandingPage = async (req, res) =>
{ {
logMsg.info("Data already inserted " +req.query.losid); logMsg.info("Data already inserted " +req.query.losid);
// Final Response // 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) if(data.length > 0)
{ {

View File

@ -2532,6 +2532,13 @@ router.delete("/DeleteTradeReference", Entitycontroller.DeleteTradeReference);
* required: true * required: true
* description: Loan ID * description: Loan ID
* example: MW112233 * 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: * responses:
* 200: * 200:
* description: success * description: success