diff --git a/app/controllers/entity.applicant.controller.js b/app/controllers/entity.applicant.controller.js new file mode 100644 index 0000000..596f9f0 --- /dev/null +++ b/app/controllers/entity.applicant.controller.js @@ -0,0 +1,28 @@ +const { sequelize,EntityApplicantMaster} = require('../models') +const { logMsg } = require('../services/logger.js'); + + + +exports.createEntityDetails = async (req, res) => +{ + try + { + await EntityApplicantMaster.create(req.body) + .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 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 new file mode 100644 index 0000000..8008623 --- /dev/null +++ b/app/controllers/master.controller.js @@ -0,0 +1,28 @@ +const { sequelize,EntityApplicantMaster} = require('../models') +const { logMsg } = require('../services/logger.js'); + +exports.MasterData = async (req, res) => +{ + try + { + await EntityApplicantMaster.findAll({where :{is_active : 1} }) + .then(data => + { + res.send({'status':200,'message':"success",'EntityApplicantMasterData':data}); + logMsg.info("Master Data List api call Success"); + }) + .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/models/ApplicantsDetails.js b/app/models/ApplicantsDetails.js new file mode 100644 index 0000000..839027f --- /dev/null +++ b/app/models/ApplicantsDetails.js @@ -0,0 +1,41 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class ApplicantsDetails 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' }) + // } + + + } + ApplicantsDetails.init( + { + entity_details_id: { type: DataTypes.INTEGER }, + name: { type: DataTypes.STRING }, + entity_type: { type: DataTypes.STRING }, + designation: { type: DataTypes.STRING }, + ownership_share_in_the_entity: { type: DataTypes.STRING }, + designatapplicant_typeion: { type: DataTypes.STRING }, + key_promoter: { type: DataTypes.INTEGER }, + bureau_name: { type: DataTypes.STRING }, + bureau_score: { type: DataTypes.STRING }, + heir_in_business_and_on_loan_struct: { type: DataTypes.STRING }, + nri: { type: DataTypes.STRING }, + createdby: { type: DataTypes.INTEGER }, + updatedby: { type: DataTypes.INTEGER }, + + }, + { + sequelize, + tableName: 'applicants', + modelName: 'ApplicantsDetails', + } + ) + return ApplicantsDetails +} diff --git a/app/models/ApplicantsRelationship.js b/app/models/ApplicantsRelationship.js new file mode 100644 index 0000000..c6970b3 --- /dev/null +++ b/app/models/ApplicantsRelationship.js @@ -0,0 +1,41 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class ApplicantsRelationship 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' }) + // } + + + } + ApplicantsRelationship.init( + { + applicant_id: { type: DataTypes.INTEGER }, + name_of_the_individual: { type: DataTypes.STRING }, + related_to: { type: DataTypes.STRING }, + relationship: { type: DataTypes.STRING }, + is_main_person_running_the_business: { type: DataTypes.INTEGER }, + no_of_years_in_this_entity: { type: DataTypes.INTEGER }, + no_of_years_in_same_line_of_buss: { type: DataTypes.INTEGER }, + dob: { type: DataTypes.DataTypes }, + age: { type: DataTypes.INTEGER }, + gender: { type: DataTypes.STRING }, + remarks: { type: DataTypes.STRING }, + createdby: { type: DataTypes.INTEGER }, + updatedby: { type: DataTypes.INTEGER }, + + }, + { + sequelize, + tableName: 'applicants_relationship', + modelName: 'ApplicantsRelationship', + } + ) + return ApplicantsRelationship +} diff --git a/app/models/EntityApplicantMaster.js b/app/models/EntityApplicantMaster.js new file mode 100644 index 0000000..11321bf --- /dev/null +++ b/app/models/EntityApplicantMaster.js @@ -0,0 +1,32 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class EntityApplicantMaster 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' }) + // } + + + } + EntityApplicantMaster.init( + { + master_name: { type: DataTypes.STRING }, + value: { type: DataTypes.STRING }, + sub_value: { type: DataTypes.STRING }, + is_active: { type: DataTypes.INTEGER } + + }, + { + sequelize, + tableName: 'entity_applicant_master', + modelName: 'EntityApplicantMaster', + } + ) + return EntityApplicantMaster +} diff --git a/app/models/EntityDetails.js b/app/models/EntityDetails.js new file mode 100644 index 0000000..e7144e5 --- /dev/null +++ b/app/models/EntityDetails.js @@ -0,0 +1,65 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class EntityDetails 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' }) + // } + + + } + EntityDetails.init( + { + loan_no_id: { type: DataTypes.INTEGER }, + snep_sep: { type: DataTypes.STRING }, + cat_of_sep: { type: DataTypes.STRING }, + sub_cat_of_sep: { type: DataTypes.STRING }, + entity_name: { type: DataTypes.STRING }, + bureau_score: { type: DataTypes.STRING }, + bureau_name: { type: DataTypes.STRING }, + entity_type: { type: DataTypes.STRING }, + entity_formation_date: { type: DataTypes.Date }, + entity_vintage_years: { type: DataTypes.STRING }, + total_no_of_members: { type: DataTypes.INTEGER }, + registered_address_of_business: { type: DataTypes.STRING }, + registered_address_state: { type: DataTypes.STRING }, + registered_address_city: { type: DataTypes.STRING }, + registered_address_pin: { type: DataTypes.INTEGER }, + registered_address_registered_address_ownership_statuspin: { type: DataTypes.STRING }, + operating_address_of_business: { type: DataTypes.STRING }, + operating_address_ownership_status: { type: DataTypes.STRING }, + operating_address_city_category: { type: DataTypes.STRING }, + operating_address_state: { type: DataTypes.STRING }, + operating_address_city: { type: DataTypes.STRING }, + operating_address_pin: { type: DataTypes.INTEGER }, + operating_address_of_business_type: { type: DataTypes.STRING }, + type_of_bussiness_activity: { type: DataTypes.STRING }, + no_of_yr_at_opaob: { type: DataTypes.INTEGER }, + area_in_which_at_opaob_is_located: { type: DataTypes.STRING }, + workplace_type: { type: DataTypes.STRING }, + others: { type: DataTypes.STRING }, + external_rating: { type: DataTypes.STRING }, + industry: { type: DataTypes.STRING }, + other_industry: { type: DataTypes.STRING }, + profile: { type: DataTypes.STRING }, + any_changes_in_dirship_parship_in_lst_6mns: { type: DataTypes.STRING }, + is_the_change_related_to_key_promoter: { type: DataTypes.STRING }, + remark_on_change__in_directorship: { type: DataTypes.STRING }, + createdby: { type: DataTypes.INTEGER }, + updatedby: { type: DataTypes.INTEGER }, + + }, + { + sequelize, + tableName: 'entity_details', + modelName: 'EntityDetails', + } + ) + return EntityDetails +} diff --git a/app/models/ResidenceAddressDetails.js b/app/models/ResidenceAddressDetails.js new file mode 100644 index 0000000..b47b8be --- /dev/null +++ b/app/models/ResidenceAddressDetails.js @@ -0,0 +1,39 @@ +'use strict' +const { Model } = require('sequelize') +module.exports = (sequelize, DataTypes) => { + class ResidenceAddressDetails 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' }) + // } + + + } + ResidenceAddressDetails.init( + { + entity_details_id: { type: DataTypes.INTEGER }, + name_of_the_individual: { type: DataTypes.STRING }, + residence_address: { type: DataTypes.STRING }, + residence_geo_limit_compliance: { type: DataTypes.STRING }, + residence_location_area: { type: DataTypes.STRING }, + ownership_status: { type: DataTypes.STRING }, + residence_stay_period_in_years: { type: DataTypes.INTEGER }, + residence_stay_period_in_bracket: { type: DataTypes.INTEGER }, + remarks: { type: DataTypes.STRING }, + createdby: { type: DataTypes.INTEGER }, + updatedby: { type: DataTypes.INTEGER }, + + }, + { + sequelize, + tableName: 'residence_address_details', + modelName: 'ResidenceAddressDetails', + } + ) + return ResidenceAddressDetails +} diff --git a/app/routes/routes.js b/app/routes/routes.js index c170e74..59576cf 100644 --- a/app/routes/routes.js +++ b/app/routes/routes.js @@ -1,14 +1,13 @@ module.exports = app => { const request = require("request"); const cors=require('cors'); - const Mycontroller = require("../controllers/test.controller.js"); + const Testcontroller = require("../controllers/test.controller.js"); + const Entitycontroller = require("../controllers/entity.applicant.controller.js"); + const Mastercontroller = require("../controllers/entity.applicant.controller.js"); const { logMsg } = require('../services/logger.js'); var router = require("express").Router(); - - - /** * @swagger * /api/demo: @@ -19,7 +18,76 @@ module.exports = app => { * 200: * description: success */ - router.get("/demo", Mycontroller.Welcome); +router.get("/demo", Testcontroller.Welcome); +/** +* @swagger +* definitions: +* createEntityDetails: +* type: object +* properties: +* loan_no_id: +* type: string +* description: losid +* example: MW12233 +* entityid: +* type: integer +* description: entityid +* example: 1 +* fy: +* type: integer +* description: financial Year +* example: 2022 +* st_type: +* type: integer +* description: statement type +* example: 2 +* additional_year_type: +* type: integer +* description: additional year type +* example: 2 +*/ +/** +* @swagger +* /api/createEntityDetails: +* post: +* summary: create entity details +* description: create a new entity +* requestBody: +* content: +* application/json: +* schema: +* $ref: '#/definitions/createEntityDetails' +* responses: +* 200: +* description: New entity details inserted +* 500: +* description: failure in inserting entity details Year +*/ +router.post("/createEntityDetails", Entitycontroller.createEntityDetails); + + + + +// Master data Api's + + +/** +* @swagger +* /api/MasterData: +* get: +* summary: Dropdown master data Api +* description: All master data for dropdown value +* responses: +* 200: +* description: success +*/ +router.get("/MasterData", Mastercontroller.MasterData); + + + + + +