diff --git a/app/controllers/loan.details.controller.js b/app/controllers/loan.details.controller.js index ecfa392..03b9bd7 100644 --- a/app/controllers/loan.details.controller.js +++ b/app/controllers/loan.details.controller.js @@ -59,7 +59,11 @@ exports.mainLandingPage = async (req, res) => //Module Wise Completion Status Data Creation Helper Call ModuleWiseStatusHelper.moduleCompletionStatusDataCreationHelper(loanDetailData.loginNo); // Final Response - 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"}); } }) + LoanDetail.findAll({raw: true , where : {losid :req.query.losid , is_active : 1}, + include: [{ model: ApplicantsDetails , // Set the alias for the relationship + attributes: [ + [sequelize.col('name'), 'loan_applicant_name'] // Alias for the 'name' column + ] , limit: 1 , order: [['createdAt', 'DESC']] }] }).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) =>