OtherParameter update api: suseendhiran
This commit is contained in:
parent
f489736f8d
commit
c54103230c
@ -1015,19 +1015,25 @@ exports.updateOtherParameters = async (req, res) =>
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
id = req.body.id;
|
req.body.forEach( async (element,index) =>
|
||||||
delete req.body.id;
|
{
|
||||||
// update value
|
id = element.id;
|
||||||
OtherParameters.update(req.body,{ where: { id: id }}).then(data =>
|
delete element.id;
|
||||||
{
|
// update value
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
OtherParameters.update(element,{ where: { id: id }}).then(data =>
|
||||||
|
{
|
||||||
|
if ([req.body].length - 1 == index) {
|
||||||
|
res.send({'status':200,'message':"success",'data':data});
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
res.send({'status':404,
|
res.send({'status':404,
|
||||||
message: err.message || "Some error occurred while retrieving statements." ,'data': "No data" });
|
message: err.message || "Some error occurred while retrieving statements." ,'data': "No data" });
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
res.send({'status':404,message: err.message || "Some error occurred while inserting statements." ,'data': "No data" });
|
res.send({'status':404,message: err.message || "Some error occurred while inserting statements." ,'data': "No data" });
|
||||||
} //end of try catch
|
} //end of try catch
|
||||||
|
|||||||
@ -2201,32 +2201,34 @@ router.get("/otherParameterMaster", Mastercontroller.otherParameterMaster);
|
|||||||
* @swagger
|
* @swagger
|
||||||
* definitions:
|
* definitions:
|
||||||
* updateOtherParameters:
|
* updateOtherParameters:
|
||||||
* type: object
|
* type: array
|
||||||
* properties:
|
* items:
|
||||||
* id:
|
* type: object
|
||||||
* type: integer
|
* properties:
|
||||||
* description:
|
* id:
|
||||||
* example: 1
|
* type: integer
|
||||||
* entity_id:
|
* description:
|
||||||
* type: integer
|
* example: 1
|
||||||
* description:
|
* entity_id:
|
||||||
* example: 1
|
* type: integer
|
||||||
* op_master_id:
|
* description:
|
||||||
* type: integer
|
* example: 1
|
||||||
* description:
|
* op_master_id:
|
||||||
* example: 1
|
* type: integer
|
||||||
* master_name:
|
* description:
|
||||||
* type: string
|
* example: 1
|
||||||
* description:
|
* master_name:
|
||||||
* example: property_own_doc_avail
|
* type: string
|
||||||
* value:
|
* description:
|
||||||
* type: string
|
* example: property_own_doc_avail
|
||||||
* description:
|
* value:
|
||||||
* example: Yes
|
* type: string
|
||||||
* updatedby:
|
* description:
|
||||||
* type: integer
|
* example: Yes
|
||||||
* description:
|
* updatedby:
|
||||||
* example: 1
|
* type: integer
|
||||||
|
* description:
|
||||||
|
* example: 1
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @swagger
|
* @swagger
|
||||||
|
|||||||
@ -213,21 +213,18 @@ function ApplicantChildTable(ApplicantName , LoanId , ApplicantId , Losid , Enti
|
|||||||
// ApplicantsRelationship Table
|
// ApplicantsRelationship Table
|
||||||
var ApplicantsRelationshipPromise = new Promise(async(resolve, reject) =>
|
var ApplicantsRelationshipPromise = new Promise(async(resolve, reject) =>
|
||||||
{
|
{
|
||||||
// if(EntityType == "Individual")
|
if(EntityType == "Individual")
|
||||||
// {
|
{
|
||||||
ApplicantsRelationshipData = { }
|
ApplicantsRelationshipData = { }
|
||||||
Object.assign(ApplicantsRelationshipData, {name_of_the_individual : ApplicantName ,applicant_id: ApplicantId, loan_no_id: LoanId ,losid: Losid });
|
Object.assign(ApplicantsRelationshipData, {name_of_the_individual : ApplicantName ,applicant_id: ApplicantId, loan_no_id: LoanId ,losid: Losid });
|
||||||
// if (ApiArray.lstApplicantsRelationship.length != 0)
|
|
||||||
// {
|
|
||||||
await ApplicantsRelationship.create(ApplicantsRelationshipData)
|
await ApplicantsRelationship.create(ApplicantsRelationshipData)
|
||||||
.then(data=>{ resolve("ApplicantsRelationship")}).catch(err=>{logMsg.info("ApplicantsRelationship Failed , Msg :" +err);});
|
.then(data=>{ resolve("ApplicantsRelationship")}).catch(err=>{logMsg.info("ApplicantsRelationship Failed , Msg :" +err);});
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
});
|
});
|
||||||
// ResidenceAddressDetails Table
|
// ResidenceAddressDetails Table
|
||||||
var ResidenceAddressDetailsPromise = new Promise(async(resolve, reject) =>
|
var ResidenceAddressDetailsPromise = new Promise(async(resolve, reject) =>
|
||||||
{
|
{
|
||||||
if(ApiArray.lstApplicantAddress.length != 0 /* && EntityType == "Individual" */)
|
if(ApiArray.lstApplicantAddress.length != 0 && EntityType == "Individual" )
|
||||||
{
|
{
|
||||||
// ResidenceAddressDetails data
|
// ResidenceAddressDetails data
|
||||||
ApiArray.lstApplicantAddress.forEach(async(ApplicantAddress,index) =>
|
ApiArray.lstApplicantAddress.forEach(async(ApplicantAddress,index) =>
|
||||||
@ -246,7 +243,6 @@ function ApplicantChildTable(ApplicantName , LoanId , ApplicantId , Losid , Enti
|
|||||||
await ResidenceAddressDetails.create(ApplicantAddress)
|
await ResidenceAddressDetails.create(ApplicantAddress)
|
||||||
.then(data=>
|
.then(data=>
|
||||||
{
|
{
|
||||||
// logMsg.info("ResidenceAddressDetails inserted");
|
|
||||||
if ([ApiArray.lstApplicantAddress].length - 1 == index)
|
if ([ApiArray.lstApplicantAddress].length - 1 == index)
|
||||||
{
|
{
|
||||||
resolve("ResidenceAddressDetails")
|
resolve("ResidenceAddressDetails")
|
||||||
@ -255,26 +251,25 @@ function ApplicantChildTable(ApplicantName , LoanId , ApplicantId , Losid , Enti
|
|||||||
.catch(err=>{logMsg.info("ResidenceAddressDetails Failed , Msg :" +err);});
|
.catch(err=>{logMsg.info("ResidenceAddressDetails Failed , Msg :" +err);});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// ResidenceAddressDetails Table
|
// PropertyOwnershipIncomeConsidered Table
|
||||||
var PropertyOwnershipIncomeConsideredPromise = new Promise(async(resolve, reject) =>
|
var PropertyOwnershipIncomeConsideredPromise = new Promise(async(resolve, reject) =>
|
||||||
{
|
{
|
||||||
// if (product == "LFMP")
|
if (Product == "LFMP")
|
||||||
// {
|
{
|
||||||
PropertyOwnershipIncomeConsideredData = { }
|
PropertyOwnershipIncomeConsideredData = { }
|
||||||
Object.assign(PropertyOwnershipIncomeConsideredData, {name_of_the_loan_applicants : ApplicantName ,applicant_id: ApplicantId, loan_no_id: LoanId ,losid: Losid });
|
Object.assign(PropertyOwnershipIncomeConsideredData, {name_of_the_loan_applicants : ApplicantName ,applicant_id: ApplicantId, loan_no_id: LoanId ,losid: Losid });
|
||||||
await PropertyOwnershipIncomeConsidered.create(PropertyOwnershipIncomeConsideredData)
|
await PropertyOwnershipIncomeConsidered.create(PropertyOwnershipIncomeConsideredData)
|
||||||
.then(data=>{ resolve("PropertyOwnershipIncomeConsidered") }).catch(err=>{logMsg.info("PropertyOwnershipIncomeConsidered Failed , Msg :" +err);});
|
.then(data=>{ resolve("PropertyOwnershipIncomeConsidered") }).catch(err=>{logMsg.info("PropertyOwnershipIncomeConsidered Failed , Msg :" +err);});
|
||||||
// }
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Promise.all([ApplicantsRelationshipPromise, ResidenceAddressDetailsPromise, PropertyOwnershipIncomeConsideredPromise ])
|
Promise.all([ApplicantsRelationshipPromise, ResidenceAddressDetailsPromise, PropertyOwnershipIncomeConsideredPromise ])
|
||||||
.then((values) => {
|
.then((values) => {
|
||||||
values.forEach(element => {
|
values.forEach(element => {
|
||||||
logMsg.info(element+ " Data Creation Success for EntityId= "+EntityId); // [3, 1337, "foo"]
|
logMsg.info(element+ " Data Creation Success for ApplicantId= "+ApplicantId); // [3, 1337, "foo"]
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user