This commit is contained in:
suseendhiran17 2022-06-24 13:47:56 +05:30
parent 9bebd5eda4
commit 0951526f88
3 changed files with 173 additions and 14 deletions

View File

@ -1,4 +1,4 @@
const { sequelize , LoanDetail , EntityDetails , ApplicantsDetails , ApplicantsRelationship , ResidenceAddressDetails , PropertyOwnershipIncomeConsidered , DueDiligenceCheck , TradeReferences , CheckTypeMaster , EnquiriesAndDisbursements , PropertyAndLtv , ATNWrelatedInputs , OtherParameter , SalesPD , ATNWrelatedInputMaster ,ATNWrelationship , OtherParameterMaster ,OtherParameterMasterValue , OtherParameterRelationship } = require('../models')
const { sequelize , LoanDetail , EntityDetails , ApplicantsDetails , ApplicantsRelationship , ResidenceAddressDetails , PropertyOwnershipIncomeConsidered , DueDiligenceCheck , TradeReferences , CheckTypeMaster , EnquiriesAndDisbursements , PropertyAndLtv , ATNWrelatedInputs , SalesPD , ATNWrelatedInputMaster ,ATNWrelationship , OtherParameterMaster ,OtherParameterMasterValue , OtherParameterRelationship , OtherParameters } = require('../models')
const { logMsg } = require('../services/logger.js');
@ -47,9 +47,29 @@ exports.createEntityDetails = async (req, res) =>
}, 500);
})
.catch(err => { logMsg.info("ATNWrelatedInputs Data Fetching Failed for EntityId= "+entityid+" Error= "+err); });
setTimeout(() => {
res.send({'status':200,'message':"success",'data':data});
}, 1000);
// otherParameter data create
OtherParameterMaster.findAll({raw: true , where : {is_active : 1}}).then(async(OtherParameterMasterData) =>
{
entityid = data.dataValues.id;
OtherParameterMasterData_arr = [];
for (const value of OtherParameterMasterData)
{
op_master_data = {entity_id:entityid , op_master_id:value.id , master_name:value.master_name};
OtherParameterMasterData_arr.push(op_master_data);
}
setTimeout(() => {
OtherParameters.bulkCreate(OtherParameterMasterData_arr)
.then(OtherParameterMasterData_arr =>{ logMsg.info("otherParameter Data Creation Success for EntityId= "+entityid); })
.catch(err =>{ logMsg.info("otherParameter Data Creation Failed for EntityId= "+entityid+" Error= "+err); });
}, 500);
})
.catch(err => { logMsg.info("otherParameter Data Fetching Failed for EntityId= "+entityid+" Error= "+err); });
setTimeout(() => {
res.send({'status':200,'message':"success",'data':data});
}, 1000);
logMsg.info("Entity created successfully");
})
@ -57,6 +77,8 @@ exports.createEntityDetails = async (req, res) =>
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" });
@ -929,6 +951,59 @@ exports.ATNWrelatedInputsList = async (req, res) =>
};
//update OtherParameter Api
exports.updateOtherParameters = async (req, res) =>
{
try
{
id = req.body.id;
delete req.body.id;
// update value
OtherParameters.update(req.body,{ where: { id: id }}).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
};
//OtherParameters List Api
exports.OtherParametersList = async (req, res) =>
{
try
{
OtherParameters.findAll({raw: true , where : {entity_id : req.query.entity_id , 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
};

View File

@ -1,13 +1,15 @@
'use strict'
const { Model } = require('sequelize')
module.exports = (sequelize, DataTypes) => {
class OtherParameter extends Model {
class OtherParameters extends Model {
}
OtherParameter.init(
OtherParameters.init(
{
email_app_for_no_female_coapplicant : { type: DataTypes.STRING },
another_applicant : { type: DataTypes.STRING },
entity_id : { type: DataTypes.INTEGER },
op_master_id : { type: DataTypes.INTEGER },
master_name : { type: DataTypes.STRING },
value : { type: DataTypes.STRING },
createdAt : { type: DataTypes.DATE },
updatedAt : { type: DataTypes.DATE },
createdby : { type: DataTypes.INTEGER },
@ -17,10 +19,10 @@ module.exports = (sequelize, DataTypes) => {
},
{
sequelize,
tableName: 'other_parameters',
modelName: 'OtherParameter',
tableName: 'other__parameters',
modelName: 'OtherParameters',
}
)
return OtherParameter
return OtherParameters
}

View File

@ -2261,7 +2261,7 @@ router.get("/loanAndLtvMaster", Mastercontroller.loanAndLtvMaster);
router.get("/atnwRelationMaster", Mastercontroller.atnwRelationMaster);
// Update DueDiligenceCheck Details
// Update updateATNWrelatedInputs Details
/**
* @swagger
* definitions:
@ -2313,7 +2313,7 @@ router.get("/atnwRelationMaster", Mastercontroller.atnwRelationMaster);
router.post("/updateATNWrelatedInputs", Entitycontroller.updateATNWrelatedInputs);
// Due Diligence Check Details List Api
// atnwrelatedInputsList Api
/**
* @swagger
* /api/atnwrelatedInputsList:
@ -2334,7 +2334,7 @@ router.post("/updateATNWrelatedInputs", Entitycontroller.updateATNWrelatedInputs
*/
router.get("/atnwrelatedInputsList", Entitycontroller.ATNWrelatedInputsList);
// otherParameterMaster select api
// otherParameter Master select api
/**
* @swagger
@ -2348,6 +2348,88 @@ router.get("/atnwrelatedInputsList", Entitycontroller.ATNWrelatedInputsList);
*/
router.get("/otherParameterMaster", Mastercontroller.otherParameterMaster);
// Update updateOtherParameters Details
/**
* @swagger
* definitions:
* updateOtherParameters:
* type: object
* properties:
* id:
* type: integer
* description:
* example: 1
* entity_id:
* type: integer
* description:
* example: 1
* op_master_id:
* type: integer
* description:
* example: 1
* master_name:
* type: string
* description:
* example: property_own_doc_avail
* value:
* type: string
* description:
* example: Yes
* updatedby:
* type: integer
* description:
* example: 1
*/
/**
* @swagger
* /api/updateOtherParameters:
* post:
* summary: update updateOtherParameters Details
* description: update updateOtherParameters
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/definitions/updateOtherParameters'
* responses:
* 200:
* description: New updated updateOtherParameters
* 500:
* description: failure in updating updateOtherParameters
*/
router.post("/updateOtherParameters", Entitycontroller.updateOtherParameters);
// OtherParametersList Api
/**
* @swagger
* /api/otherParametersList:
* get:
* summary: other Parameters List
* description: Get other Parameters List by sending entity id(Primery key)
* parameters:
* - in: query
* name: entity_id
* schema:
* type: integer
* required: true
* description: id of the entity Details (primart key of entity)
* example: 1
* responses:
* 200:
* description: success
*/
router.get("/otherParametersList", Entitycontroller.OtherParametersList);
// routes started here
app.use('/api', router);
};