entity applicant master ,susee
This commit is contained in:
parent
60b2d85176
commit
eb26753f53
@ -34,12 +34,10 @@ exports.createApplicantDetails = async (req, res) =>
|
||||
delete req.body.applicant_relationship
|
||||
delete req.body.residence_address
|
||||
delete req.body.property_ownership_income_considered ;
|
||||
|
||||
await ApplicantsDetails.create(req.body).then(async (data) =>
|
||||
{
|
||||
if(req.body.entity_type == "Individual")
|
||||
{
|
||||
|
||||
ApplicantsRelationshipData = Object.assign(ApplicantsRelationshipData, {applicant_id: data.dataValues.id});
|
||||
await ApplicantsRelationship.create(ApplicantsRelationshipData)
|
||||
.then(data=>{logMsg.info("ApplicantsRelationship inserted");}).catch(err=>{logMsg.info("ApplicantsRelationship Failed , Msg :" +err);});
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
const { sequelize,EntityApplicantMaster,StateMaster,CityMaster,PinMaster,ChecktypeCheckresultRelationMaster
|
||||
,DueDiligenceCheck,CheckResultMaster} = require('../models')
|
||||
const { logMsg } = require('../services/logger.js');
|
||||
,DueDiligenceCheck,CheckResultMaster,CheckTypeMaster} = require('../models')
|
||||
const { logMsg } = require('../services/logger.js');
|
||||
|
||||
|
||||
// select entityMaster data
|
||||
@ -16,12 +16,12 @@ const { sequelize,EntityApplicantMaster,StateMaster,CityMaster,PinMaster,Checkty
|
||||
})
|
||||
.catch(err => {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while retrieving statements." ,'data': "No data" });
|
||||
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 inserting statements." ,'data': "No data"
|
||||
message: err.message || "Some error occurred while fetching entity applicant masterdata." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
|
||||
@ -30,26 +30,23 @@ const { sequelize,EntityApplicantMaster,StateMaster,CityMaster,PinMaster,Checkty
|
||||
// create entity master data
|
||||
exports.CreateEntityApplicantMasterData = async (req, res) =>
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
await EntityApplicantMaster.create(req.body)
|
||||
.then(data =>
|
||||
{
|
||||
res.send({'status':200,'message':"success",'data':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" });
|
||||
message: err.message || "Some error occurred while create entity applicant masterdata." ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
||||
message: err.message || "Some error occurred while create entity applicant masterdata." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
|
||||
} //end of try catch
|
||||
};
|
||||
|
||||
|
||||
@ -58,7 +55,7 @@ const { sequelize,EntityApplicantMaster,StateMaster,CityMaster,PinMaster,Checkty
|
||||
{
|
||||
try
|
||||
{
|
||||
await StateMaster.findAll()
|
||||
await StateMaster.findAll({ where : {"is_active" : 1}})
|
||||
.then(data =>
|
||||
{
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
@ -66,12 +63,12 @@ const { sequelize,EntityApplicantMaster,StateMaster,CityMaster,PinMaster,Checkty
|
||||
})
|
||||
.catch(err => {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while retrieving statements." ,'data': "No data" });
|
||||
message: err.message || "Some error occurred while fetching state masterdata." ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
||||
message: err.message || "Some error occurred while fetching state masterdata." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
|
||||
@ -82,7 +79,7 @@ const { sequelize,EntityApplicantMaster,StateMaster,CityMaster,PinMaster,Checkty
|
||||
{
|
||||
try
|
||||
{
|
||||
await CityMaster.findAll({ where : { "state_id" : req.query.state_id }})
|
||||
await CityMaster.findAll({ where : { "state_id" : req.query.state_id , "is_active" : 1 }})
|
||||
.then(data =>
|
||||
{
|
||||
res.send({'status':200,'message':"success",'data':data });
|
||||
@ -90,12 +87,12 @@ const { sequelize,EntityApplicantMaster,StateMaster,CityMaster,PinMaster,Checkty
|
||||
})
|
||||
.catch(err => {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while retrieving statements." ,'data': "No data" });
|
||||
message: err.message || "Some error occurred while fetching city masterdata." ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
||||
message: err.message || "Some error occurred while fetching city masterdata." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
|
||||
@ -106,7 +103,7 @@ const { sequelize,EntityApplicantMaster,StateMaster,CityMaster,PinMaster,Checkty
|
||||
{
|
||||
try
|
||||
{
|
||||
await PinMaster.findAll({ where : { "state_id" : req.query.state_id }})
|
||||
await PinMaster.findAll({ where : { "state_id" : req.query.state_id , "is_active" : 1 }})
|
||||
.then(data =>
|
||||
{
|
||||
res.send({'status':200,'message':"success",'data':data});
|
||||
@ -114,31 +111,85 @@ const { sequelize,EntityApplicantMaster,StateMaster,CityMaster,PinMaster,Checkty
|
||||
})
|
||||
.catch(err => {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while retrieving statements." ,'data': "No data" });
|
||||
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 inserting statements." ,'data': "No data"
|
||||
message: err.message || "Some error occurred while fetching pin masterdata." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
|
||||
// select checkResultMaster
|
||||
exports.CheckResultMaster = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
const storeData = await sequelize.query('SELECT checktype_checkresult_relation_master.check_type_id , checktype_checkresult_relation_master.check_result_id, check_type_master.value AS check_type, check_result_master.value AS check_result FROM checktype_checkresult_relation_master JOIN check_type_master ON checktype_checkresult_relation_master.check_type_id = check_type_master.id JOIN check_result_master ON checktype_checkresult_relation_master.check_result_id = check_result_master.id')
|
||||
res.send({'status':200,'message':"success",'data':storeData});
|
||||
const storeData = await sequelize.query('SELECT checktype_checkresult_relation_master.check_type_id , checktype_checkresult_relation_master.check_result_id, check_type_master.value AS check_type, check_result_master.value AS check_result FROM checktype_checkresult_relation_master JOIN check_type_master ON checktype_checkresult_relation_master.check_type_id = check_type_master.id and check_type_master.is_active = 1JOIN check_result_master ON checktype_checkresult_relation_master.check_result_id = check_result_master.id and check_result_master.is_active = 1 where checktype_checkresult_relation_master.is_active = 1 ')
|
||||
res.send({'status':200,'message':"success",'data':storeData
|
||||
|
||||
})
|
||||
.catch(err => {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while fetching check result master data." ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
||||
message: err.message || "Some error occurred while fetching check result master data." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
|
||||
|
||||
};
|
||||
|
||||
// create check type master
|
||||
exports.CreateCheckTypeMaster = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await CheckTypeMaster.create(req.body)
|
||||
.then(data =>
|
||||
{
|
||||
res.send({'status':200,'message':"success",'data':"success"});
|
||||
|
||||
})
|
||||
.catch(err => {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while create type masterdata." ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while create type masterdata." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
};
|
||||
|
||||
// create relation master
|
||||
exports.CreateRelationMaster = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await ChecktypeCheckresultRelationMaster.create(req.body)
|
||||
.then(data =>
|
||||
{
|
||||
res.send({'status':200,'message':"success",'data':"success"});
|
||||
|
||||
})
|
||||
.catch(err => {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while create relation masterdata." ,'data': "No data" });
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while create relation masterdata." ,'data': "No data"
|
||||
});
|
||||
} //end of try catch
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,8 @@ module.exports = (sequelize, DataTypes) => {
|
||||
}
|
||||
CheckResultMaster.init(
|
||||
{
|
||||
value: { type: DataTypes.STRING }
|
||||
value: { type: DataTypes.STRING },
|
||||
is_active: { type: DataTypes.INTEGER }
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
|
||||
23
app/models/CheckTypeMaster.js
Normal file
23
app/models/CheckTypeMaster.js
Normal file
@ -0,0 +1,23 @@
|
||||
'use strict'
|
||||
const { Model } = require('sequelize')
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class CheckTypeMaster extends Model {
|
||||
|
||||
}
|
||||
CheckTypeMaster.init(
|
||||
{
|
||||
value: { type: DataTypes.STRING },
|
||||
is_active: { type: DataTypes.INTEGER }
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
tableName: 'check_type_master',
|
||||
modelName: 'CheckTypeMaster',
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
return CheckTypeMaster
|
||||
}
|
||||
@ -8,7 +8,8 @@ module.exports = (sequelize, DataTypes) => {
|
||||
ChecktypeCheckresultRelationMaster.init(
|
||||
{
|
||||
check_type_id: { type: DataTypes.INTEGER },
|
||||
check_result_id: { type: DataTypes.INTEGER }
|
||||
check_result_id: { type: DataTypes.INTEGER },
|
||||
is_active: { type: DataTypes.INTEGER }
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
|
||||
@ -7,7 +7,8 @@ module.exports = (sequelize, DataTypes) => {
|
||||
CityMaster.init(
|
||||
{
|
||||
state_id: { type: DataTypes.INTEGER },
|
||||
city: { type: DataTypes.STRING }
|
||||
city: { type: DataTypes.STRING },
|
||||
is_active: { type: DataTypes.INTEGER }
|
||||
|
||||
},
|
||||
{
|
||||
|
||||
@ -7,7 +7,8 @@ module.exports = (sequelize, DataTypes) => {
|
||||
PinMaster.init(
|
||||
{
|
||||
state_id: { type: DataTypes.STRING },
|
||||
pin: { type: DataTypes.INTEGER }
|
||||
pin: { type: DataTypes.INTEGER },
|
||||
is_active: { type: DataTypes.INTEGER }
|
||||
|
||||
},
|
||||
{
|
||||
|
||||
@ -6,7 +6,8 @@ module.exports = (sequelize, DataTypes) => {
|
||||
}
|
||||
StateMaster.init(
|
||||
{
|
||||
state: { type: DataTypes.STRING }
|
||||
state: { type: DataTypes.STRING },
|
||||
is_active: { type: DataTypes.INTEGER }
|
||||
|
||||
},
|
||||
{
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
const CheckTypeMaster = require("../models/CheckTypeMaster.js");
|
||||
|
||||
module.exports = app => {
|
||||
const request = require("request");
|
||||
const cors=require('cors');
|
||||
@ -172,7 +174,12 @@ router.get("/propertyOwnershipList", Entitycontroller.PropertyOwnershipList);
|
||||
*/
|
||||
router.post("/createEntityDetails", Entitycontroller.createEntityDetails);
|
||||
|
||||
|
||||
|
||||
|
||||
// Create new Applicant and it's child Details (Relationship, Address, Property ownership) //
|
||||
|
||||
|
||||
router.post("/createApplicantDetails", Entitycontroller.createApplicantDetails);
|
||||
|
||||
|
||||
@ -180,20 +187,22 @@ router.post("/createApplicantDetails", Entitycontroller.createApplicantDetails);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Master data Api's
|
||||
|
||||
// EntityApplicantMaster data select api
|
||||
/**
|
||||
* @swagger
|
||||
* /api/dropdownMasterData:
|
||||
* /api/entityApplicantMasterData:
|
||||
* get:
|
||||
* summary: Dropdown master data Api
|
||||
* description: All master data for dropdown value
|
||||
* summary: Dropdown data Api
|
||||
* description: Dropdown data for entity and applicant master data Api
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/entityApplicantMasterData", Mastercontroller.EntityApplicantMasterData); //line 7
|
||||
router.get("/entityApplicantMasterData", Mastercontroller.EntityApplicantMasterData);
|
||||
|
||||
|
||||
|
||||
@ -238,7 +247,7 @@ router.get("/entityApplicantMasterData", Mastercontroller.EntityApplicantMasterD
|
||||
* 500:
|
||||
* description: failure in inserting entity applicant details
|
||||
*/
|
||||
router.post("/createEntityApplicantMasterData", Mastercontroller.CreateEntityApplicantMasterData); // line 31
|
||||
router.post("/createEntityApplicantMasterData", Mastercontroller.CreateEntityApplicantMasterData);
|
||||
|
||||
|
||||
|
||||
@ -249,12 +258,15 @@ router.post("/createEntityApplicantMasterData", Mastercontroller.CreateEntityApp
|
||||
* /api/stateMasterData:
|
||||
* get:
|
||||
* summary: Dropdown state master data Api
|
||||
* operationId: readappmaster
|
||||
* tags:
|
||||
* - createEntityApplicantMasterData
|
||||
* description: All master data for dropdown value
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/stateMasterData", Mastercontroller.StateMasterData); // line 82
|
||||
router.get("/stateMasterData", Mastercontroller.StateMasterData);
|
||||
|
||||
|
||||
|
||||
@ -278,7 +290,7 @@ router.get("/stateMasterData", Mastercontroller.StateMasterData); // line 82
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/cityMasterData", Mastercontroller.CityMasterData); // line 106
|
||||
router.get("/cityMasterData", Mastercontroller.CityMasterData);
|
||||
|
||||
|
||||
|
||||
@ -303,7 +315,7 @@ router.get("/cityMasterData", Mastercontroller.CityMasterData); // line 106
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/pinMasterData", Mastercontroller.PinMasterData); // line 130
|
||||
router.get("/pinMasterData", Mastercontroller.PinMasterData);
|
||||
|
||||
|
||||
|
||||
@ -314,8 +326,8 @@ router.get("/pinMasterData", Mastercontroller.PinMasterData); // line 130
|
||||
* @swagger
|
||||
* /api/checkResultMasterData:
|
||||
* get:
|
||||
* summary: Due Diligence Check master data Api
|
||||
* description: Due Diligence Check master data for dropdown value
|
||||
* summary: Check result master data Api
|
||||
* description: Check result master data for dropdown value
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
@ -323,9 +335,83 @@ router.get("/pinMasterData", Mastercontroller.PinMasterData); // line 130
|
||||
router.get("/checkResultMasterData", Mastercontroller.CheckResultMaster);
|
||||
|
||||
|
||||
// create check type master
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* definitions:
|
||||
* CreateCheckTypeMaster:
|
||||
* type: object
|
||||
* properties:
|
||||
* value:
|
||||
* type: string
|
||||
* description: value
|
||||
* example: abcd
|
||||
* is_active:
|
||||
* type: integer
|
||||
* description: is_active
|
||||
* example: 1
|
||||
*/
|
||||
/**
|
||||
* @swagger
|
||||
* /api/CreateCheckTypeMaster:
|
||||
* post:
|
||||
* summary: create check type master data
|
||||
* description: create a new check type master data
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/definitions/CreateCheckTypeMaster'
|
||||
* responses:
|
||||
* 200:
|
||||
* description: New check type master data details inserted
|
||||
* 500:
|
||||
* description: failure in inserting check type master data details
|
||||
*/
|
||||
router.post('/CreateCheckTypeMaster',Mastercontroller.CreateCheckTypeMaster)
|
||||
|
||||
|
||||
|
||||
// create relation master data
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* definitions:
|
||||
* CreateRelationMaster:
|
||||
* type: object
|
||||
* properties:
|
||||
* check_type_id:
|
||||
* type: integer
|
||||
* description: checktypeid
|
||||
* example: 1
|
||||
* check_result_id:
|
||||
* type: integer
|
||||
* description: check_result_id
|
||||
* example: 1
|
||||
* is_active:
|
||||
* type: integer
|
||||
* description: is_active
|
||||
* example: 1
|
||||
*/
|
||||
/**
|
||||
* @swagger
|
||||
* /api/CreateRelationMaster:
|
||||
* post:
|
||||
* summary: create CreateRelationMaster data
|
||||
* description: create a new CreateRelationMaster data
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/definitions/CreateRelationMaster'
|
||||
* responses:
|
||||
* 200:
|
||||
* description: New CreateRelationMaster data details inserted
|
||||
* 500:
|
||||
* description: failure in inserting CreateRelationMaster data details
|
||||
*/
|
||||
router.post('/CreateRelationMaster',Mastercontroller.CreateRelationMaster)
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user