susee , initial cmt
This commit is contained in:
parent
60e9ed9708
commit
0cfeb90401
7
.env
Normal file
7
.env
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
USER_NAME = cet
|
||||||
|
PASSWORD = fpw@lu,win,iis@2021C
|
||||||
|
DATABASE = credit_policy_staging
|
||||||
|
PORT = 1433
|
||||||
|
HOST = 34.121.71.79
|
||||||
|
|
||||||
|
SERVER_PORT = 8080
|
||||||
16
app/config/db.config.js
Normal file
16
app/config/db.config.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
require('dotenv').config();
|
||||||
|
|
||||||
|
const { logMsg } = require('../services/logger');
|
||||||
|
module.exports = {
|
||||||
|
|
||||||
|
"development": {
|
||||||
|
"username": process.env.USER_NAME,
|
||||||
|
"password": process.env.PASSWORD,
|
||||||
|
"database": process.env.DATABASE,
|
||||||
|
"port": process.env.PORT,
|
||||||
|
"host": process.env.HOST,
|
||||||
|
"dialect": "mssql",
|
||||||
|
"logging": (message) =>(logMsg.info(message))
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
57
app/controllers/credit.policy.controller.js
Normal file
57
app/controllers/credit.policy.controller.js
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
const { sequelize,Test , AdjustableTang , PolicyParameterMaster } = require('../models')
|
||||||
|
const { logMsg } = require('../services/logger.js');
|
||||||
|
|
||||||
|
|
||||||
|
// select PolicyParameterMaster data
|
||||||
|
exports.ParameterMasterData = async (req, res) =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
sequelize.query('SELECT section_master.section , policy_parameter_master.parameter , policy_parameter_master.rules 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});
|
||||||
|
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
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// select AdjustableTang data
|
||||||
|
exports.AdjustableTang = async (req, res) =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
AdjustableTang.findAll({ where : { is_active : 1}}).then(data =>
|
||||||
|
{
|
||||||
|
res.send({'status':200,'message':"success",'data':data});
|
||||||
|
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
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
109
app/controllers/test.controller.js
Normal file
109
app/controllers/test.controller.js
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
const { sequelize,Test , AdjustableTang , PolicyParameterMaster } = require('../models')
|
||||||
|
const { logMsg } = require('../services/logger.js');
|
||||||
|
|
||||||
|
exports.Welcome = (req, res) =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
const Msg = "Welcome....!";
|
||||||
|
console.log(Msg);
|
||||||
|
logMsg.info("Api Call Success");
|
||||||
|
res.send({'status':200 , message:"Success." ,'data': Msg});
|
||||||
|
|
||||||
|
} catch(err) {
|
||||||
|
res.status(500).send({'status':404,
|
||||||
|
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
||||||
|
}); } //end of try catch
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
exports.createModel = async (req, res) =>
|
||||||
|
{
|
||||||
|
// var storeData = [ ];
|
||||||
|
// var a = [ "money" , "int" , "numeric" , "real" ]
|
||||||
|
// var b = [ "nvarchar" ]
|
||||||
|
// var c = [ "datetimeoffset" , "datetime" , "date"]
|
||||||
|
|
||||||
|
|
||||||
|
// let query = "SELECT COLUMN_NAME, DATA_TYPE FROM credit_policy_staging.INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='turnover_for_female_applicant';";
|
||||||
|
// storeData = await sequelize.query(query)
|
||||||
|
// storeData.forEach(async(element) => {
|
||||||
|
|
||||||
|
// Object.values(element).forEach( async (element) => {
|
||||||
|
// if ( a.includes(element.DATA_TYPE)) {
|
||||||
|
// console.log( element.COLUMN_NAME, ": { type: DataTypes.INTEGER },");
|
||||||
|
// }
|
||||||
|
// if ( b.includes(element.DATA_TYPE)) {
|
||||||
|
// console.log( element.COLUMN_NAME, ": { type: DataTypes.STRING },");
|
||||||
|
// }
|
||||||
|
// if ( c.includes(element.DATA_TYPE)) {
|
||||||
|
// console.log( element.COLUMN_NAME, ": { type: DataTypes.DATE },");
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
// });
|
||||||
|
// (update_subValue_data_element,{ where: { id: id }})
|
||||||
|
const json = '{"Residential" : { "Self Occupied" : "400","Rented" : "400","Vacant" : "400","Mixed Use" : "400"},"Commercial" : { "Self Occupied" : "200", "Rented" : "200","Vacant" : "Not Allowed","Mixed Use" : "200"},"Industrial" : { "Self Occupied" : "800","Rented" : "800","Vacant" : "Not Allowed","Mixed Use" : "Not Allowed"},"Agricultural" : { "Self Occupied" : "Not Allowed","Rented" : "Not Allowed","Vacant" : "Not Allowed","Mixed Use" : "Not Allowed"}}'
|
||||||
|
|
||||||
|
function isJson(str) {
|
||||||
|
try {
|
||||||
|
JSON.parse(str);
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log( isJson(json) )
|
||||||
|
PolicyParameterMaster.update({ rules : json } ,{ where : { id : 73 } }).then(data=> { res.send(data)}).catch(err=>{res.send(err)})
|
||||||
|
// PolicyParameterMaster.findAll({ where : { id : 48}}).then(data=> {
|
||||||
|
// res.send(data[0].rules)
|
||||||
|
// }).catch(err=>{res.send(err)})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
exports.excel = async ( req , res ) => {
|
||||||
|
// Requiring the module
|
||||||
|
const reader = require('xlsx')
|
||||||
|
|
||||||
|
// Reading our test file
|
||||||
|
const file = reader.readFile('./cr_policy.xlsx')
|
||||||
|
|
||||||
|
let data = [ ]
|
||||||
|
var obj = { };
|
||||||
|
|
||||||
|
const sheets = file.SheetNames[3]
|
||||||
|
console.log(sheets);
|
||||||
|
for(let i = 0; i < sheets.length; i++)
|
||||||
|
{
|
||||||
|
const temp = reader.utils.sheet_to_json(file.Sheets[file.SheetNames[3]])
|
||||||
|
|
||||||
|
temp.forEach((res) => {
|
||||||
|
// var key = Object.values(res);
|
||||||
|
// var obj = {}
|
||||||
|
// obj = {
|
||||||
|
// property_ownership_document_available : key[0],
|
||||||
|
// type_of_property : key[1],
|
||||||
|
// property_used_in_business : key[2],
|
||||||
|
// property_free_loan_taken : key[3],
|
||||||
|
// property_in_the_name_of_applicant : key[4],
|
||||||
|
// loan_obligated_in_cet : key[5],
|
||||||
|
// property_created_in_last_eight_yr : key[6],
|
||||||
|
// value_to_be_considered : key[7],
|
||||||
|
// mv_to_be_added_to_atnw : key[8] * 100,
|
||||||
|
// final_value_considered : key[9]
|
||||||
|
// }
|
||||||
|
data.push(res)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
res.send(data)
|
||||||
|
// AdjustableTang.bulkCreate(data).then(data=> {res.send(data)}).catch(err=>{res.send(err)})
|
||||||
|
|
||||||
|
}
|
||||||
43
app/models/AdjustableTang.js
Normal file
43
app/models/AdjustableTang.js
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class AdjustableTang extends Model {
|
||||||
|
/**
|
||||||
|
* Helper method for defining associations.
|
||||||
|
* This method is not a part of Sequelize lifecycle.
|
||||||
|
* The `models/index` file will call this method automatically.
|
||||||
|
*/
|
||||||
|
// define association here
|
||||||
|
// static associate({ Financials }) {
|
||||||
|
// this.hasMany(Financials, { foreignKey: 'entity_id', as: 'financialsData' })
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
AdjustableTang.init(
|
||||||
|
{
|
||||||
|
property_ownership_document_available : { type: DataTypes.STRING },
|
||||||
|
type_of_property : { type: DataTypes.STRING },
|
||||||
|
property_used_in_business : { type: DataTypes.STRING },
|
||||||
|
property_free_loan_taken : { type: DataTypes.STRING },
|
||||||
|
property_in_the_name_of_applicant : { type: DataTypes.STRING },
|
||||||
|
loan_obligated_in_cet : { type: DataTypes.STRING },
|
||||||
|
property_created_in_last_eight_yr : { type: DataTypes.STRING },
|
||||||
|
value_to_be_considered : { type: DataTypes.INTEGER },
|
||||||
|
mv_to_be_added_to_atnw : { type: DataTypes.INTEGER },
|
||||||
|
final_value_considered : { type: DataTypes.INTEGER },
|
||||||
|
is_active : { type: DataTypes.INTEGER },
|
||||||
|
createdby : { type: DataTypes.INTEGER },
|
||||||
|
updatedby : { type: DataTypes.INTEGER },
|
||||||
|
createdAt : { type: DataTypes.DATE },
|
||||||
|
updatedAt : { type: DataTypes.DATE },
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'adjustable_tangible_networth_property_valuation',
|
||||||
|
modelName: 'AdjustableTang',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return AdjustableTang
|
||||||
|
}
|
||||||
34
app/models/BusinessActivityMaster.js
Normal file
34
app/models/BusinessActivityMaster.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class BusinessActivityMaster extends Model {
|
||||||
|
/**
|
||||||
|
* Helper method for defining associations.
|
||||||
|
* This method is not a part of Sequelize lifecycle.
|
||||||
|
* The `models/index` file will call this method automatically.
|
||||||
|
*/
|
||||||
|
// define association here
|
||||||
|
// static associate({ Financials }) {
|
||||||
|
// this.hasMany(Financials, { foreignKey: 'entity_id', as: 'financialsData' })
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
BusinessActivityMaster.init(
|
||||||
|
{
|
||||||
|
business_activity_name : { type: DataTypes.STRING },
|
||||||
|
is_active : { type: DataTypes.INTEGER },
|
||||||
|
createdAt : { type: DataTypes.DATE },
|
||||||
|
createdby : { type: DataTypes.INTEGER },
|
||||||
|
updatedAt : { type: DataTypes.DATE },
|
||||||
|
updatedby : { type: DataTypes.INTEGER },
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'business_activity_master',
|
||||||
|
modelName: 'BusinessActivityMaster',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return BusinessActivityMaster
|
||||||
|
}
|
||||||
34
app/models/CheckTypeMaster.js
Normal file
34
app/models/CheckTypeMaster.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class CheckTypeMaster extends Model {
|
||||||
|
/**
|
||||||
|
* Helper method for defining associations.
|
||||||
|
* This method is not a part of Sequelize lifecycle.
|
||||||
|
* The `models/index` file will call this method automatically.
|
||||||
|
*/
|
||||||
|
// define association here
|
||||||
|
// static associate({ Financials }) {
|
||||||
|
// this.hasMany(Financials, { foreignKey: 'entity_id', as: 'financialsData' })
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
CheckTypeMaster.init(
|
||||||
|
{
|
||||||
|
check_type : { type: DataTypes.STRING },
|
||||||
|
is_active : { type: DataTypes.INTEGER },
|
||||||
|
createdby : { type: DataTypes.INTEGER },
|
||||||
|
updatedby : { type: DataTypes.INTEGER },
|
||||||
|
createdAt : { type: DataTypes.DATE },
|
||||||
|
updatedAt : { type: DataTypes.DATE },
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'check_type_master',
|
||||||
|
modelName: 'CheckTypeMaster',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return CheckTypeMaster
|
||||||
|
}
|
||||||
34
app/models/CreditRuleCatogaryMaster.js
Normal file
34
app/models/CreditRuleCatogaryMaster.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class CreditRuleCatogaryMaster extends Model {
|
||||||
|
/**
|
||||||
|
* Helper method for defining associations.
|
||||||
|
* This method is not a part of Sequelize lifecycle.
|
||||||
|
* The `models/index` file will call this method automatically.
|
||||||
|
*/
|
||||||
|
// define association here
|
||||||
|
// static associate({ Financials }) {
|
||||||
|
// this.hasMany(Financials, { foreignKey: 'entity_id', as: 'financialsData' })
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
CreditRuleCatogaryMaster.init(
|
||||||
|
{
|
||||||
|
category_name : { type: DataTypes.STRING },
|
||||||
|
is_active : { type: DataTypes.INTEGER },
|
||||||
|
createdby : { type: DataTypes.INTEGER },
|
||||||
|
updatedby : { type: DataTypes.INTEGER },
|
||||||
|
createdAt : { type: DataTypes.DATE },
|
||||||
|
updatedAt : { type: DataTypes.DATE },
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'credit_rule_category_master',
|
||||||
|
modelName: 'CreditRuleCatogaryMaster',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return CreditRuleCatogaryMaster
|
||||||
|
}
|
||||||
35
app/models/CreditRuleMaster.js
Normal file
35
app/models/CreditRuleMaster.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class CreditRuleMaster extends Model {
|
||||||
|
/**
|
||||||
|
* Helper method for defining associations.
|
||||||
|
* This method is not a part of Sequelize lifecycle.
|
||||||
|
* The `models/index` file will call this method automatically.
|
||||||
|
*/
|
||||||
|
// define association here
|
||||||
|
// static associate({ Financials }) {
|
||||||
|
// this.hasMany(Financials, { foreignKey: 'entity_id', as: 'financialsData' })
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
CreditRuleMaster.init(
|
||||||
|
{
|
||||||
|
category_id : { type: DataTypes.INTEGER },
|
||||||
|
credit_rule : { type: DataTypes.STRING },
|
||||||
|
is_active : { type: DataTypes.INTEGER },
|
||||||
|
createdby : { type: DataTypes.INTEGER },
|
||||||
|
updatedby : { type: DataTypes.INTEGER },
|
||||||
|
createdAt : { type: DataTypes.DATE },
|
||||||
|
updatedAt : { type: DataTypes.DATE },
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'credit_rule_master',
|
||||||
|
modelName: 'CreditRuleMaster',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return CreditRuleMaster
|
||||||
|
}
|
||||||
43
app/models/DoubleWhammy.js
Normal file
43
app/models/DoubleWhammy.js
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class DoubleWhammy extends Model {
|
||||||
|
/**
|
||||||
|
* Helper method for defining associations.
|
||||||
|
* This method is not a part of Sequelize lifecycle.
|
||||||
|
* The `models/index` file will call this method automatically.
|
||||||
|
*/
|
||||||
|
// define association here
|
||||||
|
// static associate({ Financials }) {
|
||||||
|
// this.hasMany(Financials, { foreignKey: 'entity_id', as: 'financialsData' })
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
DoubleWhammy.init(
|
||||||
|
{
|
||||||
|
program_id : { type: DataTypes.INTEGER },
|
||||||
|
check_type_id : { type: DataTypes.INTEGER },
|
||||||
|
property_type_id : { type: DataTypes.INTEGER },
|
||||||
|
property_usage : { type: DataTypes.STRING },
|
||||||
|
eligibility_factor_1 : { type: DataTypes.INTEGER },
|
||||||
|
eligibility_factor_2 : { type: DataTypes.INTEGER },
|
||||||
|
eligibility_factor_3 : { type: DataTypes.INTEGER },
|
||||||
|
eligibility_factor_4 : { type: DataTypes.INTEGER },
|
||||||
|
eligibility_factor_5 : { type: DataTypes.INTEGER },
|
||||||
|
result : { type: DataTypes.STRING },
|
||||||
|
is_active : { type: DataTypes.INTEGER },
|
||||||
|
createdby : { type: DataTypes.INTEGER },
|
||||||
|
updatedby : { type: DataTypes.INTEGER },
|
||||||
|
createdAt : { type: DataTypes.DATE },
|
||||||
|
updatedAt : { type: DataTypes.DATE },
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'double_whammy',
|
||||||
|
modelName: 'DoubleWhammy',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return DoubleWhammy
|
||||||
|
}
|
||||||
39
app/models/DscrLeverageGrid.js
Normal file
39
app/models/DscrLeverageGrid.js
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class DscrLeverageGrid extends Model {
|
||||||
|
/**
|
||||||
|
* Helper method for defining associations.
|
||||||
|
* This method is not a part of Sequelize lifecycle.
|
||||||
|
* The `models/index` file will call this method automatically.
|
||||||
|
*/
|
||||||
|
// define association here
|
||||||
|
// static associate({ Financials }) {
|
||||||
|
// this.hasMany(Financials, { foreignKey: 'entity_id', as: 'financialsData' })
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
DscrLeverageGrid.init(
|
||||||
|
{
|
||||||
|
program_id : { type: DataTypes.INTEGER },
|
||||||
|
business_activity_id : { type: DataTypes.INTEGER },
|
||||||
|
leverage : { type: DataTypes.STRING },
|
||||||
|
dscr_min : { type: DataTypes.STRING },
|
||||||
|
dscr_max : { type: DataTypes.STRING },
|
||||||
|
result : { type: DataTypes.STRING },
|
||||||
|
is_active : { type: DataTypes.INTEGER },
|
||||||
|
createdAt : { type: DataTypes.DATE },
|
||||||
|
createdby : { type: DataTypes.INTEGER },
|
||||||
|
updatedAt : { type: DataTypes.DATE },
|
||||||
|
updatedby : { type: DataTypes.INTEGER },
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'dscr_leverage_grid',
|
||||||
|
modelName: 'DscrLeverageGrid',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return DscrLeverageGrid
|
||||||
|
}
|
||||||
35
app/models/GstStateCodeMaster.js
Normal file
35
app/models/GstStateCodeMaster.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class GstStateCodeMaster extends Model {
|
||||||
|
/**
|
||||||
|
* Helper method for defining associations.
|
||||||
|
* This method is not a part of Sequelize lifecycle.
|
||||||
|
* The `models/index` file will call this method automatically.
|
||||||
|
*/
|
||||||
|
// define association here
|
||||||
|
// static associate({ Financials }) {
|
||||||
|
// this.hasMany(Financials, { foreignKey: 'entity_id', as: 'financialsData' })
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
GstStateCodeMaster.init(
|
||||||
|
{
|
||||||
|
state_code : { type: DataTypes.INTEGER },
|
||||||
|
state_name : { type: DataTypes.STRING },
|
||||||
|
is_active : { type: DataTypes.INTEGER },
|
||||||
|
createdby : { type: DataTypes.INTEGER },
|
||||||
|
updatedby : { type: DataTypes.INTEGER },
|
||||||
|
createdAt : { type: DataTypes.DATE },
|
||||||
|
updatedAt : { type: DataTypes.DATE },
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'gst_state_code_master',
|
||||||
|
modelName: 'GstStateCodeMaster',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return GstStateCodeMaster
|
||||||
|
}
|
||||||
36
app/models/LeverageUsedForEligCat.js
Normal file
36
app/models/LeverageUsedForEligCat.js
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class LeverageUsedForEligCat extends Model {
|
||||||
|
/**
|
||||||
|
* Helper method for defining associations.
|
||||||
|
* This method is not a part of Sequelize lifecycle.
|
||||||
|
* The `models/index` file will call this method automatically.
|
||||||
|
*/
|
||||||
|
// define association here
|
||||||
|
// static associate({ Financials }) {
|
||||||
|
// this.hasMany(Financials, { foreignKey: 'entity_id', as: 'financialsData' })
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
LeverageUsedForEligCat.init(
|
||||||
|
{
|
||||||
|
program_id : { type: DataTypes.INTEGER },
|
||||||
|
business_activity_id : { type: DataTypes.INTEGER },
|
||||||
|
leverage_value : { type: DataTypes.INTEGER },
|
||||||
|
is_active : { type: DataTypes.INTEGER },
|
||||||
|
createdby : { type: DataTypes.INTEGER },
|
||||||
|
updatedby : { type: DataTypes.INTEGER },
|
||||||
|
createdAt : { type: DataTypes.DATE },
|
||||||
|
updatedAt : { type: DataTypes.DATE },
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'leverage_used_for_elig_cal',
|
||||||
|
modelName: 'LeverageUsedForEligCat',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return LeverageUsedForEligCat
|
||||||
|
}
|
||||||
27
app/models/PolicyParameterMaster.js
Normal file
27
app/models/PolicyParameterMaster.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class PolicyParameterMaster extends Model {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
PolicyParameterMaster.init(
|
||||||
|
{
|
||||||
|
section_id : { type: DataTypes.INTEGER },
|
||||||
|
parameter : { type: DataTypes.STRING },
|
||||||
|
rules : { 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: 'policy_parameter_master',
|
||||||
|
modelName: 'PolicyParameterMaster',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return PolicyParameterMaster
|
||||||
|
}
|
||||||
25
app/models/ProgramMaster.js
Normal file
25
app/models/ProgramMaster.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class ProgramMaster extends Model {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
ProgramMaster.init(
|
||||||
|
{
|
||||||
|
program_name : { type: DataTypes.STRING },
|
||||||
|
is_active : { type: DataTypes.INTEGER },
|
||||||
|
createdAt : { type: DataTypes.DATE },
|
||||||
|
createdby : { type: DataTypes.INTEGER },
|
||||||
|
updatedAt : { type: DataTypes.DATE },
|
||||||
|
updatedby : { type: DataTypes.INTEGER },
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'program_master',
|
||||||
|
modelName: 'ProgramMaster',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return ProgramMaster
|
||||||
|
}
|
||||||
25
app/models/PropertyTypeMaster.js
Normal file
25
app/models/PropertyTypeMaster.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class PropertyTypeMaster extends Model {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
PropertyTypeMaster.init(
|
||||||
|
{
|
||||||
|
property_type : { type: DataTypes.STRING },
|
||||||
|
is_active : { type: DataTypes.INTEGER },
|
||||||
|
createdby : { type: DataTypes.INTEGER },
|
||||||
|
updatedby : { type: DataTypes.INTEGER },
|
||||||
|
createdAt : { type: DataTypes.DATE },
|
||||||
|
updatedAt : { type: DataTypes.DATE },
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'property_type_master',
|
||||||
|
modelName: 'PropertyTypeMaster',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return PropertyTypeMaster
|
||||||
|
}
|
||||||
25
app/models/SectionMaster.js
Normal file
25
app/models/SectionMaster.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class SectionMaster extends Model {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
SectionMaster.init(
|
||||||
|
{
|
||||||
|
section : { type: DataTypes.STRING },
|
||||||
|
is_active : { type: DataTypes.INTEGER },
|
||||||
|
createdAt : { type: DataTypes.DATE },
|
||||||
|
updatedAt : { type: DataTypes.DATE },
|
||||||
|
updatedby : { type: DataTypes.INTEGER },
|
||||||
|
createdby : { type: DataTypes.INTEGER },
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'section_master',
|
||||||
|
modelName: 'SectionMaster',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return SectionMaster
|
||||||
|
}
|
||||||
31
app/models/Test.js
Normal file
31
app/models/Test.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class Test extends Model {
|
||||||
|
/**
|
||||||
|
* Helper method for defining associations.
|
||||||
|
* This method is not a part of Sequelize lifecycle.
|
||||||
|
* The `models/index` file will call this method automatically.
|
||||||
|
*/
|
||||||
|
// define association here
|
||||||
|
// static associate({ Financials }) {
|
||||||
|
// this.hasMany(Financials, { foreignKey: 'entity_id', as: 'financialsData' })
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
Test.init(
|
||||||
|
{
|
||||||
|
losid: { type: DataTypes.STRING },
|
||||||
|
createdby: { type: DataTypes.INTEGER },
|
||||||
|
updatedby: { type: DataTypes.INTEGER },
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'test',
|
||||||
|
modelName: 'Test',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return Test
|
||||||
|
}
|
||||||
25
app/models/TurnoverFemaleApplicant.js
Normal file
25
app/models/TurnoverFemaleApplicant.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class TurnoverFemaleApplicant extends Model {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
TurnoverFemaleApplicant.init(
|
||||||
|
{
|
||||||
|
business_activity_id : { type: DataTypes.INTEGER },
|
||||||
|
Amount : { type: DataTypes.INTEGER },
|
||||||
|
createdby : { type: DataTypes.INTEGER },
|
||||||
|
updatedby : { type: DataTypes.INTEGER },
|
||||||
|
createdAt : { type: DataTypes.DATE },
|
||||||
|
updatedAt : { type: DataTypes.DATE },
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'turnover_for_female_applicant',
|
||||||
|
modelName: 'TurnoverFemaleApplicant',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return TurnoverFemaleApplicant
|
||||||
|
}
|
||||||
39
app/models/index.js
Normal file
39
app/models/index.js
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
const Sequelize = require('sequelize');
|
||||||
|
const basename = path.basename(__filename);
|
||||||
|
const env = process.env.NODE_ENV || 'development';
|
||||||
|
const config = require(__dirname + '/../config/db.config.js')[env];
|
||||||
|
//console.log(env);
|
||||||
|
//console.log(config);
|
||||||
|
const db = {};
|
||||||
|
|
||||||
|
let sequelize;
|
||||||
|
if (config.use_env_variable) {
|
||||||
|
sequelize = new Sequelize(process.env[config.use_env_variable], config);
|
||||||
|
} else {
|
||||||
|
sequelize = new Sequelize(config.database, config.username, config.password, config);
|
||||||
|
}
|
||||||
|
|
||||||
|
fs
|
||||||
|
.readdirSync(__dirname)
|
||||||
|
.filter(file => {
|
||||||
|
return (file.indexOf('.') !== 0) && (file !== basename) && (file.slice(-3) === '.js');
|
||||||
|
})
|
||||||
|
.forEach(file => {
|
||||||
|
const model = require(path.join(__dirname, file))(sequelize, Sequelize.DataTypes);
|
||||||
|
db[model.name] = model;
|
||||||
|
});
|
||||||
|
|
||||||
|
Object.keys(db).forEach(modelName => {
|
||||||
|
if (db[modelName].associate) {
|
||||||
|
db[modelName].associate(db);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
db.sequelize = sequelize;
|
||||||
|
db.Sequelize = Sequelize;
|
||||||
|
|
||||||
|
module.exports = db;
|
||||||
63
app/routes/routes.js
Normal file
63
app/routes/routes.js
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
module.exports = app => {
|
||||||
|
const request = require("request");
|
||||||
|
const cors=require('cors');
|
||||||
|
const Mycontroller = require("../controllers/test.controller.js");
|
||||||
|
const CreditPolicy = require("../controllers/credit.policy.controller");
|
||||||
|
const { logMsg } = require('../services/logger.js');
|
||||||
|
var router = require("express").Router();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /api/demo:
|
||||||
|
* get:
|
||||||
|
* summary: Demo Api
|
||||||
|
* description: Welcome Message
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: success
|
||||||
|
*/
|
||||||
|
router.get("/demo", Mycontroller.Welcome);
|
||||||
|
|
||||||
|
|
||||||
|
// Parameter Maste rData select api
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /api/ParameterMasterData:
|
||||||
|
* get:
|
||||||
|
* summary: check Parameter MasterData Api
|
||||||
|
* description: check Parameter MasterData Api
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: success
|
||||||
|
*/
|
||||||
|
router.get("/ParameterMasterData", CreditPolicy.ParameterMasterData);
|
||||||
|
|
||||||
|
|
||||||
|
// Parameter Maste rData select api
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /api/AdjustableTang:
|
||||||
|
* get:
|
||||||
|
* summary: check Adjustable Tangible MasterData Api
|
||||||
|
* description: check Adjustable Tangible MasterData Api
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: success
|
||||||
|
*/
|
||||||
|
router.get("/AdjustableTang", CreditPolicy.AdjustableTang);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// routes started here
|
||||||
|
app.use('/api', router);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
27
app/services/logger.js
Normal file
27
app/services/logger.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/**
|
||||||
|
* Configurations of logger.
|
||||||
|
*/
|
||||||
|
var winston = require('winston');
|
||||||
|
require('winston-daily-rotate-file');
|
||||||
|
|
||||||
|
var transport = new winston.transports.DailyRotateFile({
|
||||||
|
filename: 'storage/log/msg.log',
|
||||||
|
datePattern: 'YYYY-MM-DD',
|
||||||
|
zippedArchive: true,
|
||||||
|
maxSize: '20m',
|
||||||
|
maxFiles: '14d'
|
||||||
|
});
|
||||||
|
|
||||||
|
transport.on('rotate', function(oldFilename, newFilename) {
|
||||||
|
// do something fun
|
||||||
|
});
|
||||||
|
|
||||||
|
const logger = winston.createLogger({
|
||||||
|
transports: [
|
||||||
|
transport
|
||||||
|
]
|
||||||
|
});
|
||||||
|
module.exports = {
|
||||||
|
'logMsg': logger,
|
||||||
|
};
|
||||||
|
|
||||||
8711
package-lock.json
generated
Normal file
8711
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
30
package.json
Normal file
30
package.json
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"name": "smc_cet_creditpd_backend",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "server.js",
|
||||||
|
"scripts": {
|
||||||
|
"start": "nodemon server.js"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"body-parser": "^1.19.0",
|
||||||
|
"cors": "^2.8.5",
|
||||||
|
"dotenv": "^10.0.0",
|
||||||
|
"express": "^4.17.1",
|
||||||
|
"log4js": "^6.3.0",
|
||||||
|
"mssql": "^7.2.0",
|
||||||
|
"request": "^2.88.2",
|
||||||
|
"sequelize": "^6.6.5",
|
||||||
|
"swagger-jsdoc": "^6.1.0",
|
||||||
|
"swagger-ui-express": "^4.1.6",
|
||||||
|
"winston": "^3.3.3",
|
||||||
|
"winston-daily-rotate-file": "^4.5.5",
|
||||||
|
"xlsx": "^0.18.5"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"nodemon": "^2.0.12"
|
||||||
|
}
|
||||||
|
}
|
||||||
70
server.js
Normal file
70
server.js
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
require('dotenv').config();
|
||||||
|
const express = require('express')
|
||||||
|
const app = express()
|
||||||
|
//it is used to clear cache
|
||||||
|
app.use(function(req, res, next) {
|
||||||
|
res.set("Cache-Control", "no-cache, no-store, must-revalidate, max-age=0")
|
||||||
|
res.set("Pragma", "no-cache")
|
||||||
|
res.set("Expires", 0)
|
||||||
|
next()
|
||||||
|
})
|
||||||
|
const {logMsg} = require('./app/services/logger.js');
|
||||||
|
|
||||||
|
const swaggerJsdoc = require('swagger-jsdoc');
|
||||||
|
const swaggerUi = require('swagger-ui-express');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
definition: {
|
||||||
|
openapi: '3.0.0',
|
||||||
|
info: {
|
||||||
|
title: 'credit_policy_staging',
|
||||||
|
version: '1.0.0',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
apis: ['./app/routes/routes.js'], // files containing annotations as above
|
||||||
|
};
|
||||||
|
|
||||||
|
const swaggerDocument = swaggerJsdoc(options);
|
||||||
|
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @openapi
|
||||||
|
* /:
|
||||||
|
* get:
|
||||||
|
* description: Welcome to swagger-jsdoc!
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: Returns a mysterious string.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
app.get("/", (req, res) => {
|
||||||
|
res.json({ message: "Welcome to the application." });
|
||||||
|
logMsg.info("Server Sent A Welcome to the application!");
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
app.use(express.json())
|
||||||
|
app.use(express.urlencoded({ extended: true }));
|
||||||
|
|
||||||
|
|
||||||
|
require("./app/routes/routes.js")(app);
|
||||||
|
|
||||||
|
const PORT_NUMBER = process.env.SERVER_PORT
|
||||||
|
app.listen({ port: PORT_NUMBER }, async () => {
|
||||||
|
console.log('Server up on http://localhost:8080')
|
||||||
|
|
||||||
|
//await sequelize.authenticate()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"keep": {
|
||||||
|
"days": true,
|
||||||
|
"amount": 14
|
||||||
|
},
|
||||||
|
"auditLog": "storage\\log\\.09fd47a9e15e2eeeb7fc352042382aad053bea7e-audit.json",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"date": 1656486101584,
|
||||||
|
"name": "storage\\log\\msg.log.2022-06-29",
|
||||||
|
"hash": "7049e1a88637f56c3db137ea81edad88"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"date": 1656658989456,
|
||||||
|
"name": "storage\\log\\msg.log.2022-07-01",
|
||||||
|
"hash": "a401d882f6ca8da2a15b684623338e06"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"hashType": "md5"
|
||||||
|
}
|
||||||
BIN
storage/log/msg.log.2022-02-21.gz
Normal file
BIN
storage/log/msg.log.2022-02-21.gz
Normal file
Binary file not shown.
23
storage/log/msg.log.2022-06-29
Normal file
23
storage/log/msg.log.2022-06-29
Normal file
File diff suppressed because one or more lines are too long
7
storage/log/msg.log.2022-07-01
Normal file
7
storage/log/msg.log.2022-07-01
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{"level":"info","message":"Executing (default): UPDATE [policy_parameter_master] SET [rules]=@0,[updatedAt]=@1 WHERE [id] = @2"}
|
||||||
|
{"level":"info","message":"Executing (default): UPDATE [policy_parameter_master] SET [rules]=@0,[updatedAt]=@1 WHERE [id] = @2"}
|
||||||
|
{"level":"info","message":"Executing (default): UPDATE [policy_parameter_master] SET [rules]=@0,[updatedAt]=@1 WHERE [id] = @2"}
|
||||||
|
{"level":"info","message":"Executing (default): SELECT section_master.section , policy_parameter_master.parameter , policy_parameter_master.rules 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"}
|
||||||
|
{"level":"info","message":"Master Data List api call Success"}
|
||||||
|
{"level":"info","message":"Executing (default): SELECT [id], [property_ownership_document_available], [type_of_property], [property_used_in_business], [property_free_loan_taken], [property_in_the_name_of_applicant], [loan_obligated_in_cet], [property_created_in_last_eight_yr], [value_to_be_considered], [mv_to_be_added_to_atnw], [final_value_considered], [is_active], [createdby], [updatedby], [createdAt], [updatedAt] FROM [adjustable_tangible_networth_property_valuation] AS [AdjustableTang] WHERE [AdjustableTang].[is_active] = 1;"}
|
||||||
|
{"level":"info","message":"Master Data List api call Success"}
|
||||||
Loading…
Reference in New Issue
Block a user