ApplicantUpdate:GWM
This commit is contained in:
parent
2944ce3933
commit
8df3e40708
@ -132,8 +132,22 @@ exports.updateApplicantDetails = async (req, res) =>
|
|||||||
{
|
{
|
||||||
id = req.body.id;
|
id = req.body.id;
|
||||||
delete req.body.id;
|
delete req.body.id;
|
||||||
ApplicantsDetails.update(req.body,{ where: { id: id }}).then(data =>
|
ApplicantsDetails.findOne({raw: true , where: { id: id }}).then(async (ApplicantsDetailsData) =>
|
||||||
{
|
{
|
||||||
|
if(ApplicantsDetailsData.name != req.body.name)
|
||||||
|
{
|
||||||
|
ApplicantsDetails.update(req.body,{ where: { id: id }}).then(async(data) =>
|
||||||
|
{
|
||||||
|
await ApplicantsRelationship.update({name_of_the_individual:req.body.name},{ where: { applicant_id: id , is_active : 1}})
|
||||||
|
.then(data=>{logMsg.info("ApplicantsRelationship name updated");}).catch(err=>{logMsg.info("ApplicantsRelationship name update Failed , Msg :" +err);});
|
||||||
|
|
||||||
|
await ResidenceAddressDetails.update({name_of_the_individual:req.body.name},{ where: { applicant_id: id , is_active : 1}})
|
||||||
|
.then(data=>{logMsg.info("ApplicantsRelationship name updated");}).catch(err=>{logMsg.info("ApplicantsRelationship name update Failed , Msg :" +err);});
|
||||||
|
|
||||||
|
await PropertyOwnershipIncomeConsidered.update({name_of_the_loan_applicants:req.body.name,applicant_type:req.body.applicant_type},{ where: { applicant_id: id , is_active : 1}})
|
||||||
|
.then(data=>{logMsg.info("ApplicantsRelationship name updated");}).catch(err=>{logMsg.info("ApplicantsRelationship name update Failed , Msg :" +err);});
|
||||||
|
|
||||||
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
res.send({'status':200,'message':"success",'data':data});
|
||||||
|
|
||||||
})
|
})
|
||||||
@ -142,6 +156,44 @@ exports.updateApplicantDetails = async (req, res) =>
|
|||||||
message: err.message || "Some error occurred while retrieving statements." ,'data': "No data" });
|
message: err.message || "Some error occurred while retrieving statements." ,'data': "No data" });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (ApplicantsDetailsData.applicant_type != req.body.applicant_type)
|
||||||
|
{
|
||||||
|
ApplicantsDetails.update(req.body,{ where: { id: id }}).then(async(data) =>
|
||||||
|
{
|
||||||
|
await PropertyOwnershipIncomeConsidered.update({applicant_type:req.body.applicant_type},{ where: { applicant_id: id , is_active : 1}})
|
||||||
|
.then(data=>{logMsg.info("ApplicantsRelationship name updated");}).catch(err=>{logMsg.info("ApplicantsRelationship name update Failed , Msg :" +err);});
|
||||||
|
|
||||||
|
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" });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ApplicantsDetails.update(req.body,{ where: { id: id }}).then(async(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 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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user