entity_name:GWM

This commit is contained in:
sriramv 2023-08-16 11:41:22 +05:30
parent 65c4651913
commit 1d86263f94
2 changed files with 12 additions and 8 deletions

View File

@ -16,9 +16,9 @@ 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: EntityDetails , // Set the alias for the relationship
attributes: [
[sequelize.col('name'), 'loan_applicant_name'] // Alias for the 'name' column
[sequelize.col('entity_name'), 'loan_applicant_name'] // Alias for the 'name' column
] }] }).then(data =>
{
if(data.length > 0)
@ -60,9 +60,9 @@ 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
include: [{ model: EntityDetails , // Set the alias for the relationship
attributes: [
[sequelize.col('name'), 'loan_applicant_name'] // Alias for the 'name' column
[sequelize.col('entity_name'), 'loan_applicant_name'] // Alias for the 'name' column
] }] }).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
@ -179,9 +179,9 @@ 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: EntityDetails , // Set the alias for the relationship
attributes: [
[sequelize.col('name'), 'loan_applicant_name'] // Alias for the 'name' column
[sequelize.col('entity_name'), 'loan_applicant_name'] // Alias for the 'name' column
] }] }).then(data =>
{
if(data.length > 0)
@ -203,9 +203,9 @@ 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: EntityDetails , // Set the alias for the relationship
attributes: [
[sequelize.col('name'), 'loan_applicant_name'] // Alias for the 'name' column
[sequelize.col('entity_name'), 'loan_applicant_name'] // Alias for the 'name' column
] }] }).then(data =>
{
if(data.length > 0)

View File

@ -44,6 +44,10 @@ module.exports = (sequelize, DataTypes) => {
foreignKey: 'loan_no_id',
sourceKey : 'id'
});
LoanDetail.hasMany(models.EntityDetails, {
foreignKey: 'loan_no_id',
sourceKey : 'id'
});
}
return LoanDetail
}