From 640a8b680ab1b4183fa37bd88e46beb9babb9797 Mon Sep 17 00:00:00 2001 From: sriramv Date: Fri, 29 Jul 2022 12:40:11 +0530 Subject: [PATCH] browname:GWM --- app/controllers/cibil.controller.js | 25 +++++++++++++------------ app/models/InCreditFacility.js | 7 ++++++- app/models/InEnquiryDetail.js | 7 ++++++- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/app/controllers/cibil.controller.js b/app/controllers/cibil.controller.js index e34dbf4..fbdb68e 100644 --- a/app/controllers/cibil.controller.js +++ b/app/controllers/cibil.controller.js @@ -390,7 +390,7 @@ exports.EnquiryAmountSplitUp =async (req, res) => } } - InEnquiryDetail.findAll({where:where,order: [ ['DateOfEnquiry', 'DESC']]}) + InEnquiryDetail.findAll({raw:true,where:where,include: [ {model: InBorrowerDetail , attributes : ['ConsumerNameField1'] }],order: [ ['DateOfEnquiry', 'DESC']]}) .then(async(data)=>{ if(data) { @@ -436,7 +436,7 @@ exports.ConsolidatedEnquiryAmountSplitUp =async (req, res) => } } - InEnquiryDetail.findAll({where:where,order: [ ['DateOfEnquiry', 'DESC']]}) + InEnquiryDetail.findAll({raw:true,where:where,include: [ {model: InBorrowerDetail , attributes : ['ConsumerNameField1'] }],order: [ ['DateOfEnquiry', 'DESC']]}) .then(async(data)=>{ if(data) { @@ -483,7 +483,7 @@ exports.SanctionAmountSplitUp =async (req, res) => } } - InCreditFacility.findAll({where:where,order: [ ['DateOpenedDisbursed', 'DESC']]}) + InCreditFacility.findAll({raw:true,where:where,include: [ {model: InBorrowerDetail , attributes : ['ConsumerNameField1'] }],order: [ ['DateOpenedDisbursed', 'DESC']]}) .then(async(data)=>{ if(data) { @@ -531,7 +531,7 @@ exports.ConsolidatedSanctionAmountSplitUp =async (req, res) => } } - InCreditFacility.findAll({where:where,order: [ ['DateOpenedDisbursed', 'DESC']]}) + InCreditFacility.findAll({raw:true,where:where,include: [ {model: InBorrowerDetail , attributes : ['ConsumerNameField1'] }],order: [ ['DateOpenedDisbursed', 'DESC']]}) .then(async(data)=>{ if(data) { @@ -826,14 +826,15 @@ exports.test = async (req, res) => try { - - x = '01-01-1996'; - data = { - "date" : null || moment(new Date(x)).format("YYYY-MM-DD") - } + + + // x = '01-01-1996'; + // data = { + // "date" : null || moment(new Date(x)).format("YYYY-MM-DD") + // } - console.log(data); - res.send({"data":data}); + // console.log(data); + // res.send({"data":data}); } catch(err) { res.status(500).send({'status':404, @@ -852,4 +853,4 @@ exports.test = async (req, res) => - + diff --git a/app/models/InCreditFacility.js b/app/models/InCreditFacility.js index 9058e9e..579a722 100644 --- a/app/models/InCreditFacility.js +++ b/app/models/InCreditFacility.js @@ -37,7 +37,12 @@ module.exports = (sequelize, DataTypes) => { modelName: 'InCreditFacility', } ) - + InCreditFacility.associate = models => { + InCreditFacility.hasOne(models.InBorrowerDetail, { + foreignKey: 'ReferenceNumber', + sourceKey : 'ReferenceNumber' + }); + } return InCreditFacility } \ No newline at end of file diff --git a/app/models/InEnquiryDetail.js b/app/models/InEnquiryDetail.js index eeb5a76..8847a30 100644 --- a/app/models/InEnquiryDetail.js +++ b/app/models/InEnquiryDetail.js @@ -24,6 +24,11 @@ module.exports = (sequelize, DataTypes) => { } ) - + InEnquiryDetail.associate = models => { + InEnquiryDetail.hasOne(models.InBorrowerDetail, { + foreignKey: 'ReferenceNumber', + sourceKey : 'ReferenceNumber' + }); + } return InEnquiryDetail } \ No newline at end of file