diff --git a/app/controllers/credit.policy.controller.js b/app/controllers/credit.policy.controller.js index 8009c56..8612838 100644 --- a/app/controllers/credit.policy.controller.js +++ b/app/controllers/credit.policy.controller.js @@ -1,4 +1,5 @@ -const { sequelize,Test , AdjustableTang , PolicyParameterMaster , Authorization ,DoubleWhammy,DscrLeverageGrid,LeverageUsedForEligCat,ProgramMaster,CheckTypeMaster,PropertyTypeMaster,BusinessActivityMaster} = require('../models') +const { sequelize, AdjustableTang , PolicyParameterMaster , Authorization ,DoubleWhammy,DscrLeverageGrid,LeverageUsedForEligCat,ProgramMaster,CheckTypeMaster,PropertyTypeMaster,BusinessActivityMaster} = require('../models') +const {BankingNorms,BankingNorms2,CreditBureauNorms,DeviationNorms,DeviationNorms2,DeviationNorms3,DeviationNorms4,DeviationNorms5,DeviationNorms6,DeviationNorms7,FinancialsNorms,LoanEligibilityNorms,LoanEligibilityNorms2,LoanEligibilityNorms3,LoanEligibilityNorms4,PropertyNorms,PropertyNorms2,TurnoverTrendNorms } = require('../models') const { logMsg } = require('../services/logger.js'); const policyHelper = require('../services/policy.helper'); @@ -194,7 +195,7 @@ exports.PolicyMasterData = async (req, res) => { try { - sequelize.query('SELECT section_master.section , policy_parameter_master.parameter , policy_parameter_master.rules , policy_parameter_master.master_key , policy_parameter_master.data , policy_parameter_master.json FROM policy_parameter_master JOIN section_master ON policy_parameter_master.section_id = section_master.id and section_master.is_active = 1 where policy_parameter_master.is_active = 1 ') + sequelize.query('SELECT section_master.section , policy_parameter_master.parameter , policy_parameter_master.rules , policy_parameter_master.master_key , policy_parameter_master.data , policy_parameter_master.json , policy_parameter_master.table_name FROM policy_parameter_master JOIN section_master ON policy_parameter_master.section_id = section_master.id and section_master.is_active = 1 where policy_parameter_master.is_active = 1 ') .then(data => { res.send({'status':200,'message':"success",'data':data}); @@ -249,7 +250,7 @@ exports.updatePolicyMasterData = async (req, res) => delete reqData.id; if(reqData.json == 1) { - PolicyData = { } + PolicyData = { } }else { PolicyData = reqData } PolicyParameterMaster.update(PolicyData,{ where: { id: id }}) @@ -264,8 +265,143 @@ exports.updatePolicyMasterData = async (req, res) => }; +// select PolicyMasterChildTableData data +exports.PolicyMasterChildTableData = async (req, res) => +{ + try + { + Query = 'SELECT * FROM '+req.query.table_name+' where policy_parameter_master_id ='+req.query.master_key; + console.log(Query); + sequelize.query(Query) + .then(data => + { + res.send({'status':200,'message':"success",'data':data[0]}); + logMsg.info("Master Data List api call Success"); + }) + .catch(err => { + res.send({'status':404, + message: err.message || "Some error occurred while fetching entity applicant masterdata." ,'data': "No data" }); + }); + + } catch(err) { + res.send({'status':404, + message: err.message || "Some error occurred while fetching entity applicant masterdata." ,'data': "No data" + }); + } //end of try catch + +}; +exports.createPolicyMasterChildData = async (req, res) => +{ + try + { + modelArray = {banking_norms:BankingNorms , + banking_norms2:BankingNorms, + creditBureau_norms:CreditBureauNorms, + deviation_norms:DeviationNorms, + deviation_norms2:DeviationNorms2, + deviation_norms3:DeviationNorms3, + deviation_norms4:DeviationNorms4, + deviation_norms5:DeviationNorms5, + deviation_norms6:DeviationNorms6, + deviation_norms7:DeviationNorms7, + financials_norms:FinancialsNorms, + loanEligibility_norms:LoanEligibilityNorms, + loanEligibility_norms2:LoanEligibilityNorms2, + loanEligibility_norms3LoanEligibilityNorms3, + loanEligibility_norms4:LoanEligibilityNorms4, + property_norms:PropertyNorms, + property_norms2:PropertyNorms2, + turnoverTrend_norms:TurnoverTrendNorms } + modelName = req.query.table_name; + + setTimeout(async() => { + model = modelArray[modelName] ; + model.create(req.body) + .then(data=>{ res.send({'status':200,'message':"success",'data':"No data"}); }) + .catch(err=>{ res.send({'status':404,'message':"failed",'data':"No data"}); }); + }, 1500); + + // req.body.forEach((result, index, array) => { + // let Queryvalues = ''; + // let Querycolumn = ''; + // Object.keys(result).forEach((key , index , array ) => { + // //construct column name + // if(index == 0) { Querycolumn = "('"+key+"',"; } + // else if (array.length == index + 1 ) { Querycolumn += "'"+key+"')"; } + // else { Querycolumn += "'"+key+"',"; } + + // //construct column value + // if(index == 0) { if (typeof result[key] === 'string' ) { Queryvalues += "('"+result[key]+"',"; } else { Queryvalues += "("+result[key]+","; } } + // else if (array.length == index + 1 ) { if (typeof result[key] === 'string' ) { Queryvalues += "'"+result[key]+"'),"; } else { Queryvalues += result[key]+"),"; } } + // else { if (typeof result[key] === 'string' ) { Queryvalues += "'"+result[key]+"',"; } else { Queryvalues += result[key]+","; } } + + // //track ending of object loop. + // if(array.length == index+1) + // { + // Queryvalues = Queryvalues.slice(0, -1); + // Query = 'INSERT INTO '+req.query.table_name+' '+Querycolumn+' VALUES'+Queryvalues; + // // insert data here + // sequelize.query(Query).then(data => { logMsg.info("Insert Success"); }).catch(err => { logMsg.info("Insert Failed"); }); + // } + // }) + // }) + + + } catch(err) { + res.send({'status':404, + message: err.message || "Some error occurred while fetching entity applicant masterdata." ,'data': "No data" + }); + } //end of try catch + +}; + + + +exports.updatePolicyMasterChildData = async (req, res) => +{ + try + { + modelArray = {banking_norms:BankingNorms , + banking_norms2:BankingNorms, + creditBureau_norms:CreditBureauNorms, + deviation_norms:DeviationNorms, + deviation_norms2:DeviationNorms2, + deviation_norms3:DeviationNorms3, + deviation_norms4:DeviationNorms4, + deviation_norms5:DeviationNorms5, + deviation_norms6:DeviationNorms6, + deviation_norms7:DeviationNorms7, + financials_norms:FinancialsNorms, + loanEligibility_norms:LoanEligibilityNorms, + loanEligibility_norms2:LoanEligibilityNorms2, + loanEligibility_norms3LoanEligibilityNorms3, + loanEligibility_norms4:LoanEligibilityNorms4, + property_norms:PropertyNorms, + property_norms2:PropertyNorms2, + turnoverTrend_norms:TurnoverTrendNorms } + modelName = req.query.table_name; + + setTimeout(async() => { + model = modelArray[modelName] ; + id = req.body.id; + delete req.body.id; + model.update(req.body,{ where: { id: id }}) + .then(data=>{ res.send({'status':200,'message':"success",'data':"No data"}); }) + .catch(err=>{ res.send({'status':404,'message':"failed",'data':"No data"}); }); + }, 1500); + + + + } catch(err) { + res.send({'status':404, + message: err.message || "Some error occurred while fetching entity applicant masterdata." ,'data': "No data" + }); + } //end of try catch + +}; + // select DoubleWhammy data exports.DoubleWhammyDataList = async (req, res) => @@ -342,33 +478,7 @@ exports.updatePolicyMasterData = async (req, res) => }; - [{ - program:"Vanilla", - - child:[ - - [{"business_activity_name":"Retail Trader","leverage": "<=1","data":[]}, - {"business_activity_name":"Retail Trader","leverage": "<=2","data":[]}, - {"business_activity_name":"Retail Trader","leverage": "<=3","data":[]}, - {"business_activity_name":"Retail Trader","leverage": "<=4","data":[]}] , - - [{"business_activity_name":"Wholesale Trader","leverage": "<=1","data":[]}, - {"business_activity_name":"Wholesale Trader","leverage": "<=2","data":[]}, - {"business_activity_name":"Wholesale Trader","leverage": "<=3","data":[]}, - {"business_activity_name":"Wholesale Trader","leverage": "<=4","data":[]}] , - - [{"business_activity_name":"Manufacturer","leverage": "<=1","data":[]}, - {"business_activity_name":"Manufacturer","leverage": "<=2","data":[]}, - {"business_activity_name":"Manufacturer","leverage": "<=3","data":[]}, - {"business_activity_name":"Manufacturer","leverage": "<=4","data":[]}] , - - [{"business_activity_name":"Service Provider","leverage": "<=1","data":[]}, - {"business_activity_name":"Service Provider","leverage": "<=2","data":[]}, - {"business_activity_name":"Service Provider","leverage": "<=3","data":[]}, - {"business_activity_name":"Service Provider","leverage": "<=4","data":[]}] , - - ] -}] + exports.DscrLeverageGridDataList = async (req, res) => { diff --git a/app/models/BankingNorms.js b/app/models/BankingNorms.js new file mode 100644 index 0000000..2acda0e --- /dev/null +++ b/app/models/BankingNorms.js @@ -0,0 +1,28 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class BankingNorms extends Model { + + } + BankingNorms.init( + { + policy_parameter_master_id : { type: DataTypes.INTEGER }, + Normal : { type: DataTypes.STRING }, + 'RCM/ZCM_>' : { type: DataTypes.STRING }, + 'RCM/ZCM_<=' : { type: DataTypes.STRING }, + 'NCM_>' : { type: DataTypes.STRING }, + 'NCM_<=' : { type: DataTypes.STRING }, + 'CC_>' : { type: DataTypes.STRING }, + is_active : { type: DataTypes.INTEGER }, + createdby : { type: DataTypes.INTEGER }, + updatedby : { type: DataTypes.INTEGER }, + + }, + { + sequelize, + tableName: 'banking_norms', + modelName: 'BankingNorms', + } + ) + return BankingNorms +} diff --git a/app/models/BankingNorms2.js b/app/models/BankingNorms2.js new file mode 100644 index 0000000..e8f5e51 --- /dev/null +++ b/app/models/BankingNorms2.js @@ -0,0 +1,29 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class BankingNorms2 extends Model { + + } + BankingNorms2.init( + { + policy_parameter_master_id : { type: DataTypes.INTEGER }, + Normal : { type: DataTypes.STRING }, + 'CM/Sr.CM' : { type: DataTypes.STRING }, + 'RCM/ZCM' : { type: DataTypes.STRING }, + NCM : { type: DataTypes.STRING }, + CC : { type: DataTypes.STRING }, + is_active : { type: DataTypes.INTEGER }, + createdAt : { type: DataTypes.DATE }, + updatedAt : { type: DataTypes.DATE }, + createdby : { type: DataTypes.INTEGER }, + updatedby : { type: DataTypes.INTEGER } + + }, + { + sequelize, + tableName: 'banking_norms2', + modelName: 'BankingNorms2', + } + ) + return BankingNorms2 +} diff --git a/app/models/CreditBureauNorms.js b/app/models/CreditBureauNorms.js new file mode 100644 index 0000000..5d12687 --- /dev/null +++ b/app/models/CreditBureauNorms.js @@ -0,0 +1,31 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class CreditBureauNorms extends Model { + + } + CreditBureauNorms.init( + { + policy_parameter_master_id : { type: DataTypes.INTEGER }, + Vanilla : { type: DataTypes.STRING }, + Banking : { type: DataTypes.STRING }, + Industry_Margin : { type: DataTypes.STRING }, + GST_Returns : { type: DataTypes.STRING }, + Banking_V2 : { type: DataTypes.STRING }, + GPR : { type: DataTypes.STRING }, + Approval_Level : { type: DataTypes.STRING }, + is_active : { type: DataTypes.INTEGER }, + createdAt : { type: DataTypes.DATE }, + updatedAt : { type: DataTypes.DATE }, + createdby : { type: DataTypes.INTEGER }, + updatedby : { type: DataTypes.INTEGER } + + }, + { + sequelize, + tableName: 'credit_bureau_norms', + modelName: 'CreditBureauNorms', + } + ) + return CreditBureauNorms +} diff --git a/app/models/DeviationNorms.js b/app/models/DeviationNorms.js new file mode 100644 index 0000000..ac5564e --- /dev/null +++ b/app/models/DeviationNorms.js @@ -0,0 +1,33 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class DeviationNorms extends Model { + + } + DeviationNorms.init( + { + policy_parameter_master_id : { type: DataTypes.INTEGER }, + Program : { type: DataTypes.STRING }, + Non_Individual_Entity : { type: DataTypes.STRING }, + Individual_Key_Promoters : { type: DataTypes.STRING }, + 'Non_Individual_Entity_(Overall vintage)' : { type: DataTypes.STRING }, + 'RCM/ZCM_>=' : { type: DataTypes.STRING }, + 'RCM/ZCM_<' : { type: DataTypes.STRING }, + 'NCM_<' : { type: DataTypes.STRING }, + RCU_of_Business_Set_up : { type: DataTypes.STRING }, + Business_Stability_at_same_place : { type: DataTypes.STRING }, + is_active : { type: DataTypes.INTEGER }, + createdAt : { type: DataTypes.DATE }, + updatedAt : { type: DataTypes.DATE }, + createdby : { type: DataTypes.INTEGER }, + updatedby : { type: DataTypes.INTEGER } + + }, + { + sequelize, + tableName: 'deviation_norms', + modelName: 'DeviationNorms', + } + ) + return DeviationNorms +} diff --git a/app/models/DeviationNorms2.js b/app/models/DeviationNorms2.js new file mode 100644 index 0000000..310dc8c --- /dev/null +++ b/app/models/DeviationNorms2.js @@ -0,0 +1,26 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class DeviationNorms2 extends Model { + + } + DeviationNorms2.init( + { + policy_parameter_master_id : { type: DataTypes.INTEGER }, + Loan_Amount : { type: DataTypes.STRING }, + No_of_years_of_Financials : { type: DataTypes.STRING }, + is_active : { type: DataTypes.INTEGER }, + createdAt : { type: DataTypes.DATE }, + updatedAt : { type: DataTypes.DATE }, + createdby : { type: DataTypes.INTEGER }, + updatedby : { type: DataTypes.INTEGER } + + }, + { + sequelize, + tableName: 'deviation_norms2', + modelName: 'DeviationNorms2', + } + ) + return DeviationNorms2 +} diff --git a/app/models/DeviationNorms3.js b/app/models/DeviationNorms3.js new file mode 100644 index 0000000..dc08fbb --- /dev/null +++ b/app/models/DeviationNorms3.js @@ -0,0 +1,39 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class DeviationNorms3 extends Model { + + } + DeviationNorms3.init( + { + policy_parameter_master_id : { type: DataTypes.INTEGER }, + All : { type: DataTypes.STRING }, + Individual : { type: DataTypes.STRING }, + Proprietorship_Firm : { type: DataTypes.STRING }, + Unregistered_Partnership_Firm : { type: DataTypes.STRING }, + Registered_Partnership : { type: DataTypes.STRING }, + Private_Ltd_Co : { type: DataTypes.STRING }, + PLC_Closely_Held : { type: DataTypes.STRING }, + PLC_Widely_Held : { type: DataTypes.STRING }, + Limited_Liability_Partnership : { type: DataTypes.STRING }, + HUF : { type: DataTypes.STRING }, + Society : { type: DataTypes.STRING }, + Trust : { type: DataTypes.STRING }, + AOP : { type: DataTypes.STRING }, + BOI : { type: DataTypes.STRING }, + AJP : { type: DataTypes.STRING }, + is_active : { type: DataTypes.INTEGER }, + createdAt : { type: DataTypes.DATE }, + updatedAt : { type: DataTypes.DATE }, + createdby : { type: DataTypes.INTEGER }, + updatedby : { type: DataTypes.INTEGER } + + }, + { + sequelize, + tableName: 'deviation_norms3', + modelName: 'DeviationNorms3', + } + ) + return DeviationNorms3 +} diff --git a/app/models/DeviationNorms4.js b/app/models/DeviationNorms4.js new file mode 100644 index 0000000..d6b5152 --- /dev/null +++ b/app/models/DeviationNorms4.js @@ -0,0 +1,27 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class DeviationNorms4 extends Model { + + } + DeviationNorms4.init( + { + policy_parameter_master_id : { type: DataTypes.INTEGER }, + Standard : { type: DataTypes.STRING }, + Allowed_for_deviation : { type: DataTypes.STRING }, + Allowed_for_deviation_for_Property_Owner : { type: DataTypes.STRING }, + is_active : { type: DataTypes.INTEGER }, + createdAt : { type: DataTypes.DATE }, + updatedAt : { type: DataTypes.DATE }, + createdby : { type: DataTypes.INTEGER }, + updatedby : { type: DataTypes.INTEGER } + + }, + { + sequelize, + tableName: 'deviation_norms4', + modelName: 'DeviationNorms4', + } + ) + return DeviationNorms4 +} diff --git a/app/models/DeviationNorms5.js b/app/models/DeviationNorms5.js new file mode 100644 index 0000000..09c7f5f --- /dev/null +++ b/app/models/DeviationNorms5.js @@ -0,0 +1,29 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class DeviationNorms5 extends Model { + + } + DeviationNorms5.init( + { + policy_parameter_master_id : { type: DataTypes.INTEGER }, + Program : { type: DataTypes.STRING }, + Manufacturer : { type: DataTypes.STRING }, + Wholesale_Trader : { type: DataTypes.STRING }, + Retail_Trader : { type: DataTypes.STRING }, + Service_Provider : { type: DataTypes.STRING }, + is_active : { type: DataTypes.INTEGER }, + createdAt : { type: DataTypes.DATE }, + updatedAt : { type: DataTypes.DATE }, + createdby : { type: DataTypes.INTEGER }, + updatedby : { type: DataTypes.INTEGER } + + }, + { + sequelize, + tableName: 'deviation_norms5', + modelName: 'DeviationNorms5', + } + ) + return DeviationNorms5 +} diff --git a/app/models/DeviationNorms6.js b/app/models/DeviationNorms6.js new file mode 100644 index 0000000..dee340e --- /dev/null +++ b/app/models/DeviationNorms6.js @@ -0,0 +1,26 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class DeviationNorms6 extends Model { + + } + DeviationNorms6.init( + { + policy_parameter_master_id : { type: DataTypes.INTEGER }, + Min : { type: DataTypes.INTEGER }, + No_of_Guarantor_Required : { type: DataTypes.INTEGER }, + is_active : { type: DataTypes.INTEGER }, + createdAt : { type: DataTypes.DATE }, + updatedAt : { type: DataTypes.DATE }, + createdby : { type: DataTypes.INTEGER }, + updatedby : { type: DataTypes.INTEGER } + + }, + { + sequelize, + tableName: 'deviation_norms6', + modelName: 'DeviationNorms6', + } + ) + return DeviationNorms6 +} diff --git a/app/models/DeviationNorms7.js b/app/models/DeviationNorms7.js new file mode 100644 index 0000000..51b3ffb --- /dev/null +++ b/app/models/DeviationNorms7.js @@ -0,0 +1,28 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class DeviationNorms7 extends Model { + + } + DeviationNorms7.init( + { + policy_parameter_master_id : { type: DataTypes.INTEGER }, + 'Max_<=' : { type: DataTypes.INTEGER }, + 'RCM/ZCM_<=' : { type: DataTypes.INTEGER }, + 'NCM_<=': { type: DataTypes.INTEGER }, + 'CC_>' : { type: DataTypes.INTEGER }, + is_active : { type: DataTypes.INTEGER }, + createdAt : { type: DataTypes.DATE }, + updatedAt : { type: DataTypes.DATE }, + createdby : { type: DataTypes.INTEGER }, + updatedby : { type: DataTypes.INTEGER } + + }, + { + sequelize, + tableName: 'deviation_norms7', + modelName: 'DeviationNorms7', + } + ) + return DeviationNorms7 +} diff --git a/app/models/FinancialsNorms.js b/app/models/FinancialsNorms.js new file mode 100644 index 0000000..a5e6714 --- /dev/null +++ b/app/models/FinancialsNorms.js @@ -0,0 +1,30 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class FinancialsNorms extends Model { + + } + FinancialsNorms.init( + { + policy_parameter_master_id : { type: DataTypes.INTEGER }, + Vanilla_From : { type: DataTypes.STRING }, + Vanilla_To : { type: DataTypes.STRING }, + Industry_Margin_From : { type: DataTypes.STRING }, + Industry_Margin_To : { type: DataTypes.STRING }, + GPR_From : { type: DataTypes.STRING }, + GPR_To : { type: DataTypes.STRING }, + is_active : { type: DataTypes.INTEGER }, + createdAt : { type: DataTypes.DATE }, + updatedAt : { type: DataTypes.DATE }, + createdby : { type: DataTypes.INTEGER }, + updatedby : { type: DataTypes.INTEGER } + + }, + { + sequelize, + tableName: 'financials_norms', + modelName: 'FinancialsNorms', + } + ) + return FinancialsNorms +} diff --git a/app/models/LoanEligibilityNorms.js b/app/models/LoanEligibilityNorms.js new file mode 100644 index 0000000..9008923 --- /dev/null +++ b/app/models/LoanEligibilityNorms.js @@ -0,0 +1,27 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class LoanEligibilityNorms extends Model { + + } + LoanEligibilityNorms.init( + { + policy_parameter_master_id : { type: DataTypes.INTEGER }, + Program : { type: DataTypes.STRING }, + DSCR : { type: DataTypes.STRING }, + DW : { type: DataTypes.STRING }, + is_active : { type: DataTypes.INTEGER }, + createdAt : { type: DataTypes.DATE }, + updatedAt : { type: DataTypes.DATE }, + createdby : { type: DataTypes.INTEGER }, + updatedby : { type: DataTypes.INTEGER } + + }, + { + sequelize, + tableName: 'loan_eligibility_norms', + modelName: 'LoanEligibilityNorms', + } + ) + return LoanEligibilityNorms +} diff --git a/app/models/LoanEligibilityNorms2.js b/app/models/LoanEligibilityNorms2.js new file mode 100644 index 0000000..d06a409 --- /dev/null +++ b/app/models/LoanEligibilityNorms2.js @@ -0,0 +1,28 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class LoanEligibilityNorms2 extends Model { + + } + LoanEligibilityNorms2.init( + { + policy_parameter_master_id : { type: DataTypes.INTEGER }, + 'Vintage_(Yrs)' : { type: DataTypes.STRING }, + 'Doctors_(%)' : { type: DataTypes.STRING }, + 'Other_SEP_(%)' : { type: DataTypes.STRING }, + 'Vintage_(Yrs)_for_Bracket_calculation' : { type: DataTypes.STRING }, + is_active : { type: DataTypes.INTEGER }, + createdAt : { type: DataTypes.DATE }, + updatedAt : { type: DataTypes.DATE }, + createdby : { type: DataTypes.INTEGER }, + updatedby : { type: DataTypes.INTEGER } + + }, + { + sequelize, + tableName: 'loan_eligibility_norms2', + modelName: 'LoanEligibilityNorms2', + } + ) + return LoanEligibilityNorms2 +} diff --git a/app/models/LoanEligibilityNorms3.js b/app/models/LoanEligibilityNorms3.js new file mode 100644 index 0000000..a307338 --- /dev/null +++ b/app/models/LoanEligibilityNorms3.js @@ -0,0 +1,26 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class LoanEligibilityNorms3 extends Model { + + } + LoanEligibilityNorms3.init( + { + policy_parameter_master_id : { type: DataTypes.INTEGER }, + Program : { type: DataTypes.STRING }, + Percentage : { type: DataTypes.STRING }, + is_active : { type: DataTypes.INTEGER }, + createdAt : { type: DataTypes.DATE }, + updatedAt : { type: DataTypes.DATE }, + createdby : { type: DataTypes.INTEGER }, + updatedby : { type: DataTypes.INTEGER } + + }, + { + sequelize, + tableName: 'loan_eligibility_norms3', + modelName: 'LoanEligibilityNorms3', + } + ) + return LoanEligibilityNorms3 +} diff --git a/app/models/LoanEligibilityNorms4.js b/app/models/LoanEligibilityNorms4.js new file mode 100644 index 0000000..e5d21ed --- /dev/null +++ b/app/models/LoanEligibilityNorms4.js @@ -0,0 +1,29 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class LoanEligibilityNorms4 extends Model { + + } + LoanEligibilityNorms4.init( + { + policy_parameter_master_id : { type: DataTypes.INTEGER }, + Program : { type: DataTypes.STRING }, + Max : { type: DataTypes.INTEGER }, + Min : { type: DataTypes.INTEGER }, + Min_Loan_Eligibility : { type: DataTypes.INTEGER }, + Max_with_deviation : { type: DataTypes.INTEGER }, + is_active : { type: DataTypes.INTEGER }, + createdAt : { type: DataTypes.DATE }, + updatedAt : { type: DataTypes.DATE }, + createdby : { type: DataTypes.INTEGER }, + updatedby : { type: DataTypes.INTEGER } + + }, + { + sequelize, + tableName: 'loan_eligibility_norms4', + modelName: 'LoanEligibilityNorms4', + } + ) + return LoanEligibilityNorms4 +} diff --git a/app/models/PolicyParameterMaster.js b/app/models/PolicyParameterMaster.js index d0b1052..9cfc196 100644 --- a/app/models/PolicyParameterMaster.js +++ b/app/models/PolicyParameterMaster.js @@ -13,6 +13,7 @@ module.exports = (sequelize, DataTypes) => { master_key : { type: DataTypes.INTEGER }, data : { type: DataTypes.INTEGER }, json : { type: DataTypes.INTEGER }, + table_name : { type: DataTypes.STRING }, is_active : { type: DataTypes.INTEGER }, createdAt : { type: DataTypes.DATE }, updatedAt : { type: DataTypes.DATE }, diff --git a/app/models/PropertyNorms.js b/app/models/PropertyNorms.js new file mode 100644 index 0000000..0c98e62 --- /dev/null +++ b/app/models/PropertyNorms.js @@ -0,0 +1,26 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class PropertyNorms extends Model { + + } + PropertyNorms.init( + { + policy_parameter_master_id : { type: DataTypes.INTEGER }, + 'Max_Variance_in_2_Valuations_10%' : { type: DataTypes.INTEGER }, + 'Max_Variance_in_2_Valuations_>10%' : { type: DataTypes.INTEGER }, + is_active : { type: DataTypes.INTEGER }, + createdAt : { type: DataTypes.DATE }, + updatedAt : { type: DataTypes.DATE }, + createdby : { type: DataTypes.INTEGER }, + updatedby : { type: DataTypes.INTEGER } + + }, + { + sequelize, + tableName: 'property_norms', + modelName: 'PropertyNorms', + } + ) + return PropertyNorms +} diff --git a/app/models/PropertyNorms2.js b/app/models/PropertyNorms2.js new file mode 100644 index 0000000..de7b13b --- /dev/null +++ b/app/models/PropertyNorms2.js @@ -0,0 +1,29 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class PropertyNorms2 extends Model { + + } + PropertyNorms2.init( + { + policy_parameter_master_id : { type: DataTypes.INTEGER }, + Property_Type : { type: DataTypes.STRING }, + Self_Occupied : { type: DataTypes.STRING }, + Rented : { type: DataTypes.STRING }, + Vacant : { type: DataTypes.STRING }, + Mixed_Use : { type: DataTypes.STRING }, + is_active : { type: DataTypes.INTEGER }, + createdAt : { type: DataTypes.DATE }, + updatedAt : { type: DataTypes.DATE }, + createdby : { type: DataTypes.INTEGER }, + updatedby : { type: DataTypes.INTEGER } + + }, + { + sequelize, + tableName: 'property_norms2', + modelName: 'PropertyNorms2', + } + ) + return PropertyNorms2 +} diff --git a/app/models/TurnoverTrendNorms.js b/app/models/TurnoverTrendNorms.js new file mode 100644 index 0000000..f612670 --- /dev/null +++ b/app/models/TurnoverTrendNorms.js @@ -0,0 +1,29 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class TurnoverTrendNorms extends Model { + + } + TurnoverTrendNorms.init( + { + policy_parameter_master_id : { type: DataTypes.INTEGER }, + Program : { type: DataTypes.STRING }, + 'RCM/ZCM_<' : { type: DataTypes.STRING }, + 'NCM_<' : { type: DataTypes.STRING }, + 'CC_<' : { type: DataTypes.STRING }, + 'Dip_in_TO_in _2_consecutive_years' : { type: DataTypes.STRING }, + is_active : { type: DataTypes.INTEGER }, + createdAt : { type: DataTypes.DATE }, + updatedAt : { type: DataTypes.DATE }, + createdby : { type: DataTypes.INTEGER }, + updatedby : { type: DataTypes.INTEGER } + + }, + { + sequelize, + tableName: 'turnover_trend_norms', + modelName: 'TurnoverTrendNorms', + } + ) + return TurnoverTrendNorms +} diff --git a/app/routes/routes.js b/app/routes/routes.js index 167d034..d74780b 100644 --- a/app/routes/routes.js +++ b/app/routes/routes.js @@ -352,6 +352,70 @@ router.post("/createBusinessActivityData", CreditPolicy.createBusinessActivityDa router.post("/updateBusinessActivityData", CreditPolicy.updateBusinessActivityData); +// Parameter Master Child Table Data select api +/** + * @swagger + * /api/PolicyMasterChildTableData: + * get: + * summary: + * description: + * parameters: + * - in: query + * name: table_name + * schema: + * type: string + * required: true + * example: financials_norms + * - in: query + * name: master_key + * schema: + * type: integer + * required: true + * example: 10 + * responses: + * 200: + * description: success + */ + router.get("/PolicyMasterChildTableData", CreditPolicy.PolicyMasterChildTableData); + //create Policy Master Child Data + /** + * @swagger + * /api/createPolicyMasterChildData: + * post: + * summary: (post method ) need to attach creation object as body + * description: + * parameters: + * - in: query + * name: table_name + * schema: + * type: string + * required: true + * example: financials_norms + * responses: + * 200: + * description: success + */ + router.post("/createPolicyMasterChildData", CreditPolicy.createPolicyMasterChildData); + //update Policy Master Child Data + /** + * @swagger + * /api/updatePolicyMasterChildData: + * post: + * summary: (post method ) need to attach updation object as body + * description: + * parameters: + * - in: query + * name: table_name + * schema: + * type: string + * required: true + * example: financials_norms + * responses: + * 200: + * description: success + */ + router.post("/updatePolicyMasterChildData", CreditPolicy.updatePolicyMasterChildData); + // Parameter Master Data select api /**