This commit is contained in:
suseendhiran17 2023-08-10 14:50:00 +05:30
parent d7b8b96f8f
commit 68a06b6451

View File

@ -16,10 +16,10 @@ exports.mainLandingPage = async (req, res) =>
if(req.query.is_loan_api_call == 0)
{
LoanDetail.findAll({raw: true ,where:{ losid:req.query.losid , is_active : 1},
include: [{ model: ApplicantsDetails , // Set the alias for the relationship
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 =>
] , where: { 'applicant_type' : 'Main Applicant'} }] }).then(data =>
{
if(data.length > 0)
{
@ -60,10 +60,10 @@ exports.mainLandingPage = async (req, res) =>
ModuleWiseStatusHelper.moduleCompletionStatusDataCreationHelper(loanDetailData.loginNo);
// Final Response
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"}); } })
include: [{ model: ApplicantsDetails , // Set the alias for the relationship
attributes: [
[sequelize.col('name'), 'loan_applicant_name'] // Alias for the 'name' column
] , where: { 'applicant_type' : 'Main Applicant'} }] }).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) =>
@ -150,6 +150,7 @@ exports.mainLandingPage = async (req, res) =>
name : [value.firstName, value.middleName, value.lastName ].filter(Boolean).join(" "), // concat and ignore null
pan_no : value.panNo,
entity_type : value.kycType.trim(),
applicant_type : 'Main Applicant'
}
lstApplicantKYCDetailDataArray.push(lstApplicantKYCDetailObj);
}
@ -178,10 +179,10 @@ exports.mainLandingPage = async (req, res) =>
{
logMsg.info("Los api call Failed " +req.query.losid);
LoanDetail.findAll({raw: true , where : {losid :req.query.losid , is_active : 1},
include: [{ model: ApplicantsDetails , // Set the alias for the relationship
include: [{ model: ApplicantsDetails , // Set the alias for the relationship
attributes: [
[sequelize.col('name'), 'loan_applicant_name'] // Alias for the 'name' column
] , limit: 1 }] }).then(data =>
] , where: { 'applicant_type' : 'Main Applicant'} }] }).then(data =>
{
if(data.length > 0)
{
@ -202,10 +203,10 @@ exports.mainLandingPage = async (req, res) =>
logMsg.info("Data already inserted " +req.query.losid);
// Final Response
LoanDetail.findAll({raw: true , where : {losid :req.query.losid , is_active : 1},
include: [{ model: ApplicantsDetails , // Set the alias for the relationship
include: [{ model: ApplicantsDetails , // Set the alias for the relationship
attributes: [
[sequelize.col('name'), 'loan_applicant_name'] // Alias for the 'name' column
] , limit: 1 }]}).then(data =>
] , where: { 'applicant_type' : 'Main Applicant'} }] }).then(data =>
{
if(data.length > 0)
{