susee
This commit is contained in:
parent
aa90979106
commit
9bebd5eda4
@ -1,10 +1,10 @@
|
||||
const { sequelize , LoanDetail , EntityDetails , ApplicantsDetails , ApplicantsRelationship , ResidenceAddressDetails , PropertyOwnershipIncomeConsidered , DueDiligenceCheck , TradeReferences , CheckTypeMaster , EnquiriesAndDisbursements , PropertyAndLtv , ATNWrelatedInputs , OtherParameter , SalesPD} = require('../models')
|
||||
const { sequelize , LoanDetail , EntityDetails , ApplicantsDetails , ApplicantsRelationship , ResidenceAddressDetails , PropertyOwnershipIncomeConsidered , DueDiligenceCheck , TradeReferences , CheckTypeMaster , EnquiriesAndDisbursements , PropertyAndLtv , ATNWrelatedInputs , OtherParameter , SalesPD , ATNWrelatedInputMaster ,ATNWrelationship , OtherParameterMaster ,OtherParameterMasterValue , OtherParameterRelationship } = require('../models')
|
||||
const { logMsg } = require('../services/logger.js');
|
||||
|
||||
|
||||
|
||||
|
||||
//create EntityDetails Api
|
||||
//create EntityDetails , DueDiligenceCheck And ATNWrelatedInputs API
|
||||
exports.createEntityDetails = async (req, res) =>
|
||||
{
|
||||
try
|
||||
@ -27,10 +27,30 @@ exports.createEntityDetails = async (req, res) =>
|
||||
}, 500);
|
||||
})
|
||||
.catch(err => { logMsg.info("DueDiligenceCheckType Data Fetching Failed for EntityId= "+entityid+" Error= "+err); });
|
||||
|
||||
|
||||
|
||||
// ATNWrelatedInput data create
|
||||
ATNWrelatedInputMaster.findAll({raw: true , where : {is_active : 1}}).then(async(ATNWrelatedInputMasterData) =>
|
||||
{
|
||||
entityid = data.dataValues.id;
|
||||
ATNWrelatedInputMasterData_arr = [];
|
||||
for (const value of ATNWrelatedInputMasterData)
|
||||
{
|
||||
atnw_master_data = {entity_id:entityid , atnw_related_input_id:value.id , atnw_related_input:value.master_name};
|
||||
ATNWrelatedInputMasterData_arr.push(atnw_master_data);
|
||||
}
|
||||
setTimeout(() => {
|
||||
ATNWrelatedInputs.bulkCreate(ATNWrelatedInputMasterData_arr)
|
||||
.then(ATNWrelatedInputMasterData_arr =>{ logMsg.info("ATNWrelatedInputs Data Creation Success for EntityId= "+entityid); })
|
||||
.catch(err =>{ logMsg.info("ATNWrelatedInputs Data Creation Failed for EntityId= "+entityid+" Error= "+err); });
|
||||
}, 500);
|
||||
})
|
||||
.catch(err => { logMsg.info("ATNWrelatedInputs Data Fetching Failed for EntityId= "+entityid+" Error= "+err); });
|
||||
setTimeout(() => {
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
}, 1000);
|
||||
|
||||
|
||||
logMsg.info("Entity created successfully");
|
||||
})
|
||||
.catch(err => {
|
||||
@ -692,42 +712,29 @@ exports.EntityApplicantNameList = async (req, res) =>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//update updateATNWrelatedInputs Api
|
||||
exports.updateATNWrelatedInputs = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
id = req.body.id;
|
||||
delete req.body.id;
|
||||
// update value
|
||||
ATNWrelatedInputs.update(req.body,{ where: { id: id }}).then(data =>
|
||||
{
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
|
||||
})
|
||||
.catch(err => {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while retrieving statements." ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,message: err.message || "Some error occurred while inserting statements." ,'data': "No data" });
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -895,6 +902,33 @@ exports.updateLoanDetail = async (req, res) =>
|
||||
}
|
||||
|
||||
|
||||
//ATNWrelatedInputsList List Api
|
||||
exports.ATNWrelatedInputsList = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
ATNWrelatedInputs.findAll({raw: true , where : {entity_id : req.query.entity_id , 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"});
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while retrieving statements." ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,message: err.message || "Some error occurred while inserting statements." ,'data': "No data" });
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
const { sequelize,EntityApplicantMaster,StateMaster,CityMaster,PinMaster,ChecktypeCheckresultRelationMaster
|
||||
,DueDiligenceCheck,CheckResultMaster,CheckTypeMaster,LoanAndLtvMaster} = require('../models')
|
||||
,DueDiligenceCheck,CheckResultMaster,CheckTypeMaster,LoanAndLtvMaster , ATNWrelatedInputMaster ,
|
||||
ATNWrelatedInputMasterValues ,ATNWrelatedInputs, ATNWrelationship ,
|
||||
OtherParameterMaster ,OtherParameterMasterValue , OtherParameterRelationship} = require('../models')
|
||||
const { logMsg } = require('../services/logger.js');
|
||||
|
||||
|
||||
@ -127,9 +129,9 @@ const { logMsg } = require('../services/logger.js');
|
||||
{
|
||||
try
|
||||
{
|
||||
const storeData = await sequelize.query('SELECT checktype_checkresult_relation_master.check_type_id , checktype_checkresult_relation_master.check_result_id, check_type_master.value AS check_type, check_result_master.value AS check_result FROM checktype_checkresult_relation_master JOIN check_type_master ON checktype_checkresult_relation_master.check_type_id = check_type_master.id and check_type_master.is_active = 1JOIN check_result_master ON checktype_checkresult_relation_master.check_result_id = check_result_master.id and check_result_master.is_active = 1 where checktype_checkresult_relation_master.is_active = 1 ')
|
||||
res.send({'status':200,'message':"success",'data':storeData
|
||||
|
||||
sequelize.query('SELECT checktype_checkresult_relation_master.check_type_id , checktype_checkresult_relation_master.check_result_id, check_type_master.value AS check_type, check_result_master.value AS check_result FROM checktype_checkresult_relation_master JOIN check_type_master ON checktype_checkresult_relation_master.check_type_id = check_type_master.id and check_type_master.is_active = 1JOIN check_result_master ON checktype_checkresult_relation_master.check_result_id = check_result_master.id and check_result_master.is_active = 1 where checktype_checkresult_relation_master.is_active = 1 ')
|
||||
.then((data)=> {
|
||||
res.send({'status':200,'message':"success",'data':data})
|
||||
})
|
||||
.catch(err => {
|
||||
res.send({'status':404,
|
||||
@ -217,6 +219,64 @@ const { logMsg } = require('../services/logger.js');
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
// select atnwRelationMaster
|
||||
exports.atnwRelationMaster = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
sequelize.query('SELECT atnw_relationship.atnw_master_id , atnw_relationship.atnw_value_id, atnw_related_input_master_name.master_name AS atnw_master_data , atnw_related_input_master_value.value AS atnw_master_value FROM atnw_relationship JOIN atnw_related_input_master_name ON atnw_relationship.atnw_master_id = atnw_related_input_master_name.id and atnw_related_input_master_name.is_active = 1 JOIN atnw_related_input_master_value ON atnw_relationship.atnw_value_id = atnw_related_input_master_value.id and atnw_related_input_master_value.is_active = 1 where atnw_relationship.is_active = 1 ')
|
||||
.then((data)=> {
|
||||
res.send({'status':200,'message':"success",'data':data})
|
||||
})
|
||||
.catch(err => {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while fetching check result master data." ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while fetching check result master data." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// select atnwRelationMaster
|
||||
exports.otherParameterMaster = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
sequelize.query('SELECT other_parameter_relationship.master_name_id , other_parameter_relationship.master_vaue_id, other_parameter_master.master_name AS other_parameter_master, other_parameter_master_value.value AS other_parameter_master_value FROM other_parameter_relationship JOIN other_parameter_master ON other_parameter_relationship.master_name_id = other_parameter_master.id and other_parameter_master.is_active = 1 JOIN other_parameter_master_value ON other_parameter_relationship.master_vaue_id = other_parameter_master_value.id and other_parameter_master_value.is_active = 1 where other_parameter_relationship.is_active = 1 ')
|
||||
.then((data)=> {
|
||||
res.send({'status':200,'message':"success",'data':data})
|
||||
})
|
||||
|
||||
.catch(err => {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while fetching other Parameter Master data." ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while fetching other Parameter Master data." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// // select pin master data
|
||||
// exports.PinMasterData = async (req, res) =>
|
||||
// {
|
||||
|
||||
@ -23,7 +23,7 @@ exports.createModel = async (req, res) =>
|
||||
var storeData = [ ];
|
||||
var a = [ "money" , "int" , "numeric" , "real" ]
|
||||
var b = [ "nvarchar" ]
|
||||
var c = [ "datetimeoffset" , "datetime"]
|
||||
var c = [ "datetimeoffset" , "datetime" , "date" ]
|
||||
|
||||
|
||||
let query = "SELECT COLUMN_NAME, DATA_TYPE FROM mainapp_staging.INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='sales_PD';";
|
||||
|
||||
25
app/models/ATNWrelatedInputMaster.js
Normal file
25
app/models/ATNWrelatedInputMaster.js
Normal file
@ -0,0 +1,25 @@
|
||||
'use strict'
|
||||
const { Model } = require('sequelize')
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class ATNWrelatedInputMaster extends Model {
|
||||
|
||||
}
|
||||
ATNWrelatedInputMaster.init(
|
||||
{
|
||||
master_name: { type: DataTypes.STRING },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER },
|
||||
is_active: {type : DataTypes.INTEGER}
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
tableName: 'atnw_related_input_master_name',
|
||||
modelName: 'ATNWrelatedInputMaster',
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
return ATNWrelatedInputMaster
|
||||
}
|
||||
25
app/models/ATNWrelatedInputMasterValue.js
Normal file
25
app/models/ATNWrelatedInputMasterValue.js
Normal file
@ -0,0 +1,25 @@
|
||||
'use strict'
|
||||
const { Model } = require('sequelize')
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class ATNWrelatedInputMasterValues extends Model {
|
||||
|
||||
}
|
||||
ATNWrelatedInputMasterValues.init(
|
||||
{
|
||||
value: { type: DataTypes.STRING },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER },
|
||||
is_active: {type : DataTypes.INTEGER}
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
tableName: 'atnw_related_input_master_value',
|
||||
modelName: 'ATNWrelatedInputMasterValues',
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
return ATNWrelatedInputMasterValues
|
||||
}
|
||||
@ -6,15 +6,10 @@ module.exports = (sequelize, DataTypes) => {
|
||||
}
|
||||
ATNWrelatedInputs.init(
|
||||
{
|
||||
property_ownership : { type: DataTypes.STRING },
|
||||
property_type : { type: DataTypes.STRING },
|
||||
property_used_in_business : { type: DataTypes.STRING },
|
||||
property_free : { type: DataTypes.STRING },
|
||||
property_in_the_name_of_applicant : { type: DataTypes.STRING },
|
||||
loan_obligated_in_cet : { type: DataTypes.STRING },
|
||||
property_created_last_eight_yr : { type: DataTypes.STRING },
|
||||
desktop_valuation : { type: DataTypes.STRING },
|
||||
final_amount_to_be_added : { type: DataTypes.STRING },
|
||||
entity_id : { type: DataTypes.INTEGER },
|
||||
atnw_related_input_id : { type: DataTypes.INTEGER },
|
||||
atnw_related_input : { type: DataTypes.STRING },
|
||||
atnw_related_input_value : { type: DataTypes.STRING },
|
||||
createdAt : { type: DataTypes.DATE },
|
||||
updatedAt : { type: DataTypes.DATE },
|
||||
createdby : { type: DataTypes.INTEGER },
|
||||
@ -24,7 +19,7 @@ module.exports = (sequelize, DataTypes) => {
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
tableName: 'ATNW_related_inputs',
|
||||
tableName: 'atnw_related_inputs',
|
||||
modelName: 'ATNWrelatedInputs',
|
||||
}
|
||||
)
|
||||
|
||||
26
app/models/ATNWrelationship.js
Normal file
26
app/models/ATNWrelationship.js
Normal file
@ -0,0 +1,26 @@
|
||||
'use strict'
|
||||
const { Model } = require('sequelize')
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class ATNWrelationship extends Model {
|
||||
|
||||
}
|
||||
ATNWrelationship.init(
|
||||
{
|
||||
atnw_master_id: { type: DataTypes.INTEGER },
|
||||
atnw_value_id: { type: DataTypes.INTEGER },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER },
|
||||
is_active: {type : DataTypes.INTEGER}
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
tableName: 'atnw_relationship',
|
||||
modelName: 'ATNWrelationship',
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
return ATNWrelationship
|
||||
}
|
||||
25
app/models/OtherParameterMaster.js
Normal file
25
app/models/OtherParameterMaster.js
Normal file
@ -0,0 +1,25 @@
|
||||
'use strict'
|
||||
const { Model } = require('sequelize')
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class OtherParameterMaster extends Model {
|
||||
|
||||
}
|
||||
OtherParameterMaster.init(
|
||||
{
|
||||
master_name: { type: DataTypes.STRING },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER },
|
||||
is_active: {type : DataTypes.INTEGER}
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
tableName: 'other_parameter_master',
|
||||
modelName: 'OtherParameterMaster',
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
return OtherParameterMaster
|
||||
}
|
||||
25
app/models/OtherParameterMasterValue.js
Normal file
25
app/models/OtherParameterMasterValue.js
Normal file
@ -0,0 +1,25 @@
|
||||
'use strict'
|
||||
const { Model } = require('sequelize')
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class OtherParameterMasterValue extends Model {
|
||||
|
||||
}
|
||||
OtherParameterMasterValue.init(
|
||||
{
|
||||
value: { type: DataTypes.STRING },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER },
|
||||
is_active: {type : DataTypes.INTEGER}
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
tableName: 'other_parameter_master_value',
|
||||
modelName: 'OtherParameterMasterValue',
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
return OtherParameterMasterValue
|
||||
}
|
||||
26
app/models/OtherParameterRelationship.js
Normal file
26
app/models/OtherParameterRelationship.js
Normal file
@ -0,0 +1,26 @@
|
||||
'use strict'
|
||||
const { Model } = require('sequelize')
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class OtherParameterRelationship extends Model {
|
||||
|
||||
}
|
||||
OtherParameterRelationship.init(
|
||||
{
|
||||
master_name_id: { type: DataTypes.INTEGER },
|
||||
master_vaue_id: { type: DataTypes.INTEGER },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER },
|
||||
is_active: {type : DataTypes.INTEGER}
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
tableName: 'other_parameter_relationship',
|
||||
modelName: 'OtherParameterRelationship',
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
return OtherParameterRelationship
|
||||
}
|
||||
@ -2245,6 +2245,109 @@ router.post("/updateLoanDetail", Entitycontroller.updateLoanDetail);
|
||||
*/
|
||||
router.get("/loanAndLtvMaster", Mastercontroller.loanAndLtvMaster);
|
||||
|
||||
|
||||
// CheckResultMaster select api
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/atnwRelationMaster:
|
||||
* get:
|
||||
* summary: atnw Relation Master data Api
|
||||
* description: atnw Relation Master data Api
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/atnwRelationMaster", Mastercontroller.atnwRelationMaster);
|
||||
|
||||
|
||||
// Update DueDiligenceCheck Details
|
||||
/**
|
||||
* @swagger
|
||||
* definitions:
|
||||
* updateATNWrelatedInputs:
|
||||
* type: object
|
||||
* properties:
|
||||
* id:
|
||||
* type: integer
|
||||
* description:
|
||||
* example: 1
|
||||
* entity_id:
|
||||
* type: integer
|
||||
* description:
|
||||
* example: 1
|
||||
* atnw_related_input_id:
|
||||
* type: integer
|
||||
* description:
|
||||
* example: 1
|
||||
* atnw_related_input:
|
||||
* type: string
|
||||
* description:
|
||||
* example: property_own_doc_avail
|
||||
* atnw_related_input_value:
|
||||
* type: string
|
||||
* description:
|
||||
* example: Yes
|
||||
* updatedby:
|
||||
* type: integer
|
||||
* description:
|
||||
* example: 1
|
||||
*/
|
||||
/**
|
||||
* @swagger
|
||||
* /api/updateATNWrelatedInputs:
|
||||
* post:
|
||||
* summary: update updateATNWrelatedInputs Details
|
||||
* description: update updateATNWrelatedInputs
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/definitions/updateATNWrelatedInputs'
|
||||
* responses:
|
||||
* 200:
|
||||
* description: New updated updateATNWrelatedInputs
|
||||
* 500:
|
||||
* description: failure in updating updateATNWrelatedInputs
|
||||
*/
|
||||
router.post("/updateATNWrelatedInputs", Entitycontroller.updateATNWrelatedInputs);
|
||||
|
||||
|
||||
// Due Diligence Check Details List Api
|
||||
/**
|
||||
* @swagger
|
||||
* /api/atnwrelatedInputsList:
|
||||
* get:
|
||||
* summary: atnw related Inputs List
|
||||
* description: Get atnw related Inputs List by sending entity id(Primery key)
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: entity_id
|
||||
* schema:
|
||||
* type: integer
|
||||
* required: true
|
||||
* description: id of the entity Details (primart key of entity)
|
||||
* example: 1
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/atnwrelatedInputsList", Entitycontroller.ATNWrelatedInputsList);
|
||||
|
||||
// otherParameterMaster select api
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/otherParameterMaster:
|
||||
* get:
|
||||
* summary: other Parameter Master data Api
|
||||
* description: other Parameter Master data Api
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/otherParameterMaster", Mastercontroller.otherParameterMaster);
|
||||
|
||||
// routes started here
|
||||
app.use('/api', router);
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user