susee
This commit is contained in:
parent
9bf2d8db78
commit
31722ce944
@ -1286,12 +1286,6 @@ exports.test = async (req, res) =>
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// exports.queryConstruct = async (req, res) => {
|
// exports.queryConstruct = async (req, res) => {
|
||||||
// try
|
// try
|
||||||
// {
|
// {
|
||||||
|
|||||||
@ -15,7 +15,11 @@ exports.mainLandingPage = async (req, res) =>
|
|||||||
|
|
||||||
if(req.query.is_loan_api_call == 0)
|
if(req.query.is_loan_api_call == 0)
|
||||||
{
|
{
|
||||||
LoanDetail.findAll({raw: true ,where:{ losid:req.query.losid , is_active : 1}}).then(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)
|
if(data.length > 0)
|
||||||
{
|
{
|
||||||
@ -44,7 +48,7 @@ exports.mainLandingPage = async (req, res) =>
|
|||||||
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"),
|
||||||
sourcing_channel_name : loanDetailData.source,
|
sourcing_channel_type : loanDetailData.source,
|
||||||
additional_loan_amnt_applied_for : Number(loanDetailData.loanAmount),
|
additional_loan_amnt_applied_for : Number(loanDetailData.loanAmount),
|
||||||
product : loanDetailData.loanProductName,
|
product : loanDetailData.loanProductName,
|
||||||
pd_id : loanDetailData.pD_ID
|
pd_id : loanDetailData.pD_ID
|
||||||
@ -169,7 +173,11 @@ exports.mainLandingPage = async (req, res) =>
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
logMsg.info("Los api call Failed " +req.query.losid);
|
logMsg.info("Los api call Failed " +req.query.losid);
|
||||||
LoanDetail.findAll({raw: true , where : {losid :req.query.losid , is_active : 1}}).then(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 }] }).then(data =>
|
||||||
{
|
{
|
||||||
if(data.length > 0)
|
if(data.length > 0)
|
||||||
{
|
{
|
||||||
@ -189,7 +197,11 @@ 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 : {losid :req.query.losid , is_active : 1}}).then(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 }]}).then(data =>
|
||||||
{
|
{
|
||||||
if(data.length > 0)
|
if(data.length > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -10,8 +10,8 @@ module.exports = (sequelize, DataTypes) => {
|
|||||||
// applicationNo: { type: DataTypes.INTEGER },
|
// applicationNo: { type: DataTypes.INTEGER },
|
||||||
product : { type: DataTypes.STRING },
|
product : { type: DataTypes.STRING },
|
||||||
date_of_login: { type: DataTypes.INTEGER },
|
date_of_login: { type: DataTypes.INTEGER },
|
||||||
sourcing_channel_type: { type: DataTypes.INTEGER },
|
sourcing_channel_type: { type: DataTypes.STRING },
|
||||||
sourcing_channel_name: { type: DataTypes.INTEGER },
|
sourcing_channel_name: { type: DataTypes.STRING },
|
||||||
proposal: { type: DataTypes.INTEGER },
|
proposal: { type: DataTypes.INTEGER },
|
||||||
sanction_date_of_earlier_exposure: { type: DataTypes.STRING },
|
sanction_date_of_earlier_exposure: { type: DataTypes.STRING },
|
||||||
sanction_amount_of_earlier_exposure: { type: DataTypes.INTEGER },
|
sanction_amount_of_earlier_exposure: { type: DataTypes.INTEGER },
|
||||||
@ -38,5 +38,11 @@ module.exports = (sequelize, DataTypes) => {
|
|||||||
modelName: 'LoanDetail',
|
modelName: 'LoanDetail',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
LoanDetail.associate = models => {
|
||||||
|
LoanDetail.hasMany(models.ApplicantsDetails, {
|
||||||
|
foreignKey: 'loan_no_id',
|
||||||
|
sourceKey : 'id'
|
||||||
|
});
|
||||||
|
}
|
||||||
return LoanDetail
|
return LoanDetail
|
||||||
}
|
}
|
||||||
@ -16,7 +16,7 @@ module.exports = (sequelize, DataTypes) => {
|
|||||||
}
|
}
|
||||||
PropertyAndLtv.init(
|
PropertyAndLtv.init(
|
||||||
{
|
{
|
||||||
losid: { type: DataTypes.INTEGER },
|
losid: { type: DataTypes.STRING },
|
||||||
product : { type: DataTypes.STRING },
|
product : { type: DataTypes.STRING },
|
||||||
address_of_prop_to_be_mortgaged : { type: DataTypes.STRING },
|
address_of_prop_to_be_mortgaged : { type: DataTypes.STRING },
|
||||||
property_type : { type: DataTypes.STRING },
|
property_type : { type: DataTypes.STRING },
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user