diff --git a/app/controllers/entity.applicant.controller.js b/app/controllers/entity.applicant.controller.js index 0c2fb41..1994302 100644 --- a/app/controllers/entity.applicant.controller.js +++ b/app/controllers/entity.applicant.controller.js @@ -1,4 +1,4 @@ -const { sequelize , LoanDetail , EntityDetails , ApplicantsDetails , ApplicantsRelationship , ResidenceAddressDetails , PropertyOwnershipIncomeConsidered , DueDiligenceCheck , TradeReferences , CheckTypeMaster , EnquiriesAndDisbursements} = require('../models') +const { sequelize , LoanDetail , EntityDetails , ApplicantsDetails , ApplicantsRelationship , ResidenceAddressDetails , PropertyOwnershipIncomeConsidered , DueDiligenceCheck , TradeReferences , CheckTypeMaster , EnquiriesAndDisbursements , PropertyAndLtv , ATNWrelatedInputs , OtherParameter , SalesPD} = require('../models') const { logMsg } = require('../services/logger.js'); @@ -690,6 +690,49 @@ exports.EntityApplicantNameList = async (req, res) => }; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + //this api for SalesPd module (not for this module use) exports.MainApplicantDetailsList = async (req, res) => { @@ -719,13 +762,85 @@ exports.MainApplicantDetailsList = async (req, res) => }; +//New + +//create Property & LTV Details Api +exports.createPropertyAndLtv = async (req, res) => +{ + try + { + PropertyAndLtv.create(req.body).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 + +}; + +//update Property & LTV Details Api +exports.updatePropertyAndLtv = async (req, res) => +{ + try + { + id = req.body.id; + updatedby = req.body.updatedby; + delete req.body.id; + delete req.body.updatedby; + // update old value is_active = 0 where requested id + await PropertyAndLtv.update({ updatedby : updatedby ,is_active : 0 },{ where: { id: id }}); + // create new entry + PropertyAndLtv.create(req.body).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 + +} - - - - - +//Property & LTV Details List Api +exports.PropertyAndLtvList = async (req, res) => +{ + try + { + PropertyAndLtv.findAll({raw: true , where : {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 + +}; diff --git a/app/controllers/master.controller.js b/app/controllers/master.controller.js index 96ca43b..2773d75 100644 --- a/app/controllers/master.controller.js +++ b/app/controllers/master.controller.js @@ -193,4 +193,28 @@ const { logMsg } = require('../services/logger.js'); }; + // // select pin master data + // exports.PinMasterData = async (req, res) => + // { + // try + // { + // await PinMaster.findAll({ where : { "state_id" : req.query.state_id , "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 pin masterdata." ,'data': "No data" }); + // }); + + // } catch(err) { + // res.send({'status':404, + // message: err.message || "Some error occurred while fetching pin masterdata." ,'data': "No data" + // }); + // } //end of try catch + + // }; + \ No newline at end of file diff --git a/app/controllers/test.controller.js b/app/controllers/test.controller.js index e66f02b..ee40ee4 100644 --- a/app/controllers/test.controller.js +++ b/app/controllers/test.controller.js @@ -15,4 +15,34 @@ exports.Welcome = (req, res) => message: err.message || "Some error occurred while inserting statements." ,'data': "No data" }); } //end of try catch -}; \ No newline at end of file +}; + + +exports.createModel = async (req, res) => +{ + var storeData = [ ]; + var a = [ "money" , "int" , "numeric" , "real" ] + var b = [ "nvarchar" ] + var c = [ "datetimeoffset" , "datetime"] + + + let query = "SELECT COLUMN_NAME, DATA_TYPE FROM mainapp_staging.INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='sales_PD';"; + 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 },"); + } + }); + + }); + + +}; diff --git a/app/models/ATNWrelatedInputs.js b/app/models/ATNWrelatedInputs.js new file mode 100644 index 0000000..4ca342b --- /dev/null +++ b/app/models/ATNWrelatedInputs.js @@ -0,0 +1,33 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class ATNWrelatedInputs extends Model { + + } + 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 }, + createdAt : { type: DataTypes.DATE }, + updatedAt : { type: DataTypes.DATE }, + createdby : { type: DataTypes.INTEGER }, + updatedby : { type: DataTypes.INTEGER }, + is_active : { type: DataTypes.INTEGER }, + + }, + { + sequelize, + tableName: 'ATNW_related_inputs', + modelName: 'ATNWrelatedInputs', + } + ) + + return ATNWrelatedInputs +} \ No newline at end of file diff --git a/app/models/LoanDetail.js b/app/models/LoanDetail.js index 18f512a..f32ad7a 100644 --- a/app/models/LoanDetail.js +++ b/app/models/LoanDetail.js @@ -6,7 +6,9 @@ module.exports = (sequelize, DataTypes) => { } LoanDetail.init( { + losid: { type: DataTypes.INTEGER }, loan_no: { type: DataTypes.INTEGER }, + product : { type: DataTypes.STRING }, date_of_login: { type: DataTypes.INTEGER }, sourcing_channel_type: { type: DataTypes.INTEGER }, sourcing_channel_name: { type: DataTypes.INTEGER }, diff --git a/app/models/OtherParameter.js b/app/models/OtherParameter.js new file mode 100644 index 0000000..275d4c5 --- /dev/null +++ b/app/models/OtherParameter.js @@ -0,0 +1,26 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class OtherParameter extends Model { + + } + OtherParameter.init( + { + email_app_for_no_female_coapplicant : { type: DataTypes.STRING }, + another_applicant : { type: DataTypes.STRING }, + createdAt : { type: DataTypes.DATE }, + updatedAt : { type: DataTypes.DATE }, + createdby : { type: DataTypes.INTEGER }, + updatedby : { type: DataTypes.INTEGER }, + is_active : { type: DataTypes.INTEGER }, + + }, + { + sequelize, + tableName: 'other_parameters', + modelName: 'OtherParameter', + } + ) + + return OtherParameter +} \ No newline at end of file diff --git a/app/models/PropertyAndLtv.js b/app/models/PropertyAndLtv.js new file mode 100644 index 0000000..21fdc73 --- /dev/null +++ b/app/models/PropertyAndLtv.js @@ -0,0 +1,59 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class PropertyAndLtv 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' }) + // } + + + } + PropertyAndLtv.init( + { + losid: { type: DataTypes.INTEGER }, + product : { type: DataTypes.STRING }, + address_of_prop_to_be_mortgaged : { type: DataTypes.STRING }, + property_type : { type: DataTypes.STRING }, + property_usage : { type: DataTypes.STRING }, + structure_type : { type: DataTypes.STRING }, + slum_type : { type: DataTypes.STRING }, + property_completion_stage : { type: DataTypes.STRING }, + stage_of_construction : { type: DataTypes.STRING }, + property_area : { type: DataTypes.STRING }, + activity_in_property : { type: DataTypes.STRING }, + mark_valuation_1 : { type: DataTypes.INTEGER }, + mark_valuation_2 : { type: DataTypes.INTEGER }, + variance_in_mv1_and_mv2 : { type: DataTypes.INTEGER }, // + override : { type: DataTypes.STRING }, + market_val_considered_for_ltv_calculation : { type: DataTypes.INTEGER }, + ltv_on_loan_applied_for : { type: DataTypes.STRING }, + max_ltv_norms_as_per_policy : { type: DataTypes.STRING }, + ltv_norms : { type: DataTypes.STRING }, + residual_life_of_property_for_1yr : { type: DataTypes.STRING }, + residual_life_of_property_for_2yr : { type: DataTypes.STRING }, + residual_life_of_property_considered_years : { type: DataTypes.STRING }, + comp_of_loan_tenure_to_residual_life_of_property : { type: DataTypes.STRING }, + norms_of_residual_age_of_property_years : { type: DataTypes.STRING }, + carpet_area_of_property_to_be_mortgage_sqft : { type: DataTypes.STRING }, + carpet_area_of_property_norms : { type: DataTypes.STRING }, + createdAt : { type: DataTypes.DATE }, + createdby : { type: DataTypes.INTEGER }, + updatedAt : { type: DataTypes.DATE }, + updatedby : { type: DataTypes.INTEGER }, + is_active : { type: DataTypes.INTEGER }, + + }, + { + sequelize, + tableName: 'property_and_ltv_details', + modelName: 'PropertyAndLtv', + } + ) + return PropertyAndLtv +} diff --git a/app/models/SalesPD.js b/app/models/SalesPD.js new file mode 100644 index 0000000..3db3b62 --- /dev/null +++ b/app/models/SalesPD.js @@ -0,0 +1,25 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class SalesPD extends Model { + + } + SalesPD.init( + { + sales_pd_done : { type: DataTypes.STRING }, + mode_of_sales_pd : { type: DataTypes.STRING }, + updatedAt : { type: DataTypes.DATE }, + createdby : { type: DataTypes.INTEGER }, + updatedby : { type: DataTypes.INTEGER }, + is_active : { type: DataTypes.INTEGER }, + + }, + { + sequelize, + tableName: 'sales_PD', + modelName: 'SalesPD', + } + ) + + return SalesPD +} \ No newline at end of file diff --git a/app/routes/routes.js b/app/routes/routes.js index 277570a..c47f8a2 100644 --- a/app/routes/routes.js +++ b/app/routes/routes.js @@ -20,6 +20,8 @@ module.exports = app => { */ router.get("/demo", Testcontroller.Welcome); +// router.get("/createModel", Testcontroller.createModel); + // entity_applicant_name list for banking module /** * @swagger @@ -1677,12 +1679,322 @@ router.post("/CreateCheckTypeMaster", Mastercontroller.CreateCheckTypeMaster); */ router.post("/CreateRelationMaster", Mastercontroller.CreateRelationMaster); // line 31 +//New + +// create Property & LTV Details +/** +* @swagger +* definitions: +* createPropertyAndLtv: +* type: object +* properties: +* losid: +* type: string +* description: losid +* example: MW112233 +* product: +* type: string +* description: product +* example: LFMP +* address_of_prop_to_be_mortgaged: +* type: string +* description: address +* example: +* property_type: +* type: string +* description: property type +* example: Residential +* property_usage: +* type: string +* description: Property Usage +* example: Self Occupied +* structure_type: +* type: string +* description: structure type +* example: Flat +* slum_type: +* type: string +* description: slum type +* example: Communal Housing +* property_completion_stage: +* type: string +* description: property completion stage +* example: Under-Construction +* stage_of_construction: +* type: string +* description: stage of construction +* example: +* property_area: +* type: string +* description: property area +* example: Positive +* activity_in_property: +* type: string +* description: activity in property +* example: Commercial +* mark_valuation_1: +* type: integer +* description: mark valuation 1 +* example: +* mark_valuation_2: +* type: integer +* description: mark valuation 2 +* example: +* variance_in_mv1_and_mv2: +* type: integer +* description: variance in mv1 and mv2 +* example: +* override: +* type: string +* description: override +* example: Higher +* market_val_considered_for_ltv_calculation: +* type: integer +* description: market val considered for ltv calculation +* example: +* ltv_on_loan_applied_for: +* type: string +* description: ltv on loan applied for +* example: +* max_ltv_norms_as_per_policy: +* type: string +* description: max ltv norms as per policy +* example: +* ltv_norms: +* type: string +* description: ltv norms +* example: +* residual_life_of_property_for_1yr: +* type: string +* description: residual life of property for 1yr +* example: +* residual_life_of_property_for_2yr: +* type: string +* description: residual life of property for 2yr +* example: +* residual_life_of_property_considered_years: +* type: string +* description: residual life of property considered years +* example: +* comp_of_loan_tenure_to_residual_life_of_property: +* type: string +* description: comp of loan tenure to residual life of property +* example: +* norms_of_residual_age_of_property_years: +* type: string +* description: norms of residual age of property years +* example: +* carpet_area_of_property_to_be_mortgage_sqft: +* type: string +* description: carpet area of property to be mortgage sqft +* example: +* carpet_area_of_property_norms: +* type: string +* description: carpet area of property norms +* example: +* createdby: +* type: integer +* description: +* example: 1 +* updatedby: +* type: integer +* description: +* example: 1 +* is_active: +* type: integer +* description: +* example: 1 +*/ +/** +* @swagger +* /api/createPropertyAndLtv: +* post: +* summary: create Property And Ltv Details +* description: create Property And Ltv Details +* requestBody: +* content: +* application/json: +* schema: +* $ref: '#/definitions/createPropertyAndLtv' +* responses: +* 200: +* description: New Property And Ltv Details inserted +* 500: +* description: failure in inserting Property And Ltv Details +*/ +router.post("/createPropertyAndLtv", Entitycontroller.createPropertyAndLtv); + +// update Property & LTV Details +/** +* @swagger +* definitions: +* updatePropertyAndLtv: +* type: object +* properties: +* id: +* type: integer +* description: +* example: 1 +* losid: +* type: string +* description: losid +* example: MW112233 +* product: +* type: string +* description: product +* example: LFMP +* address_of_prop_to_be_mortgaged: +* type: string +* description: address +* example: +* property_type: +* type: string +* description: property type +* example: Residential +* property_usage: +* type: string +* description: Property Usage +* example: Self Occupied +* structure_type: +* type: string +* description: structure type +* example: Flat +* slum_type: +* type: string +* description: slum type +* example: Communal Housing +* property_completion_stage: +* type: string +* description: property completion stage +* example: Under-Construction +* stage_of_construction: +* type: string +* description: stage of construction +* example: +* property_area: +* type: string +* description: property area +* example: Positive +* activity_in_property: +* type: string +* description: activity in property +* example: Commercial +* mark_valuation_1: +* type: integer +* description: mark valuation 1 +* example: +* mark_valuation_2: +* type: integer +* description: mark valuation 2 +* example: +* variance_in_mv1_and_mv2: +* type: integer +* description: variance in mv1 and mv2 +* example: +* override: +* type: string +* description: override +* example: Higher +* market_val_considered_for_ltv_calculation: +* type: integer +* description: market val considered for ltv calculation +* example: +* ltv_on_loan_applied_for: +* type: string +* description: ltv on loan applied for +* example: +* max_ltv_norms_as_per_policy: +* type: string +* description: max ltv norms as per policy +* example: +* ltv_norms: +* type: string +* description: ltv norms +* example: +* residual_life_of_property_for_1yr: +* type: string +* description: residual life of property for 1yr +* example: +* residual_life_of_property_for_2yr: +* type: string +* description: residual life of property for 2yr +* example: +* residual_life_of_property_considered_years: +* type: string +* description: residual life of property considered years +* example: +* comp_of_loan_tenure_to_residual_life_of_property: +* type: string +* description: comp of loan tenure to residual life of property +* example: +* norms_of_residual_age_of_property_years: +* type: string +* description: norms of residual age of property years +* example: +* carpet_area_of_property_to_be_mortgage_sqft: +* type: string +* description: carpet area of property to be mortgage sqft +* example: +* carpet_area_of_property_norms: +* type: string +* description: carpet area of property norms +* example: +* createdby: +* type: integer +* description: +* example: 1 +* updatedby: +* type: integer +* description: +* example: 1 +* is_active: +* type: integer +* description: +* example: 1 +*/ +/** +* @swagger +* /api/updatePropertyAndLtv: +* post: +* summary: update Property And Ltv Details +* description: update Property And Ltv Details +* requestBody: +* content: +* application/json: +* schema: +* $ref: '#/definitions/updatePropertyAndLtv' +* responses: +* 200: +* description: New Property And Ltv Details inserted +* 500: +* description: failure in inserting Property And Ltv Details +*/ +router.post("/updatePropertyAndLtv", Entitycontroller.updatePropertyAndLtv); + + +// Property & LTV Details List Api +/** +* @swagger +* /api/PropertyAndLtvList: +* get: +* summary: Property And Ltv List +* description: Get Property And Ltv List +* parameters: +* - in: query +* name: losid +* schema: +* type: string +* required: true +* description: Loan ID +* example: MW112233 +* responses: +* 200: +* description: success +*/ +router.get("/PropertyAndLtvList", Entitycontroller.PropertyAndLtvList); - - - // routes started here app.use('/api', router); };