updateOtherincome : suseendhiran

This commit is contained in:
suseendhiran17 2022-07-28 10:29:23 +05:30
parent 4e7f57113b
commit adc1249600
3 changed files with 4491 additions and 52 deletions

View File

@ -54,21 +54,24 @@ exports.updateOtherIncome = async (req, res) =>
{ {
try try
{ {
IncomeData = req.body; var updateOtherIncome = new Promise(async(resolve, reject) => {
for(const IncomeData of req.body)
await OtherIncomeP.update({updatedby:IncomeData.updatedby},{where:{id:IncomeData.id}}).catch(err=>{logMsg.info(err);}); {
await OtherIncomeP.update({updatedby:IncomeData.updatedby},{where:{id:IncomeData.id}}).catch(err=>{logMsg.info(err);});
IncomeData.childData.forEach(async(child_data) => { for(const [index , child_data] of IncomeData.childData.entries())
await OtherIncomeC.update({value:child_data.value},{where:{id:child_data.id,other_income_id:child_data.other_income_id,column_name:child_data.column_name}}) {
.catch(err=>{logMsg.info(err);}); await OtherIncomeC.update({value:child_data.value},{where:{id:child_data.id,other_income_id:child_data.other_income_id,column_name:child_data.column_name}})
}); .then(data=>{
setTimeout(() => { if (index === [IncomeData.childData].length -1) { resolve(data); }
res.send({'status':200 , message:"Success." ,'data': "no data"}); })
}, 300); .catch(err=>{logMsg.info(err);});
}
}
});
updateOtherIncome.then(async(data)=>{
res.send({'status':200 , message:"Success." ,'data': data});
});
} catch(err) { } catch(err) {
res.status(500).send({'status':404, res.status(500).send({'status':404,
message: err.message || "Some error occurred while inserting statements." ,'data': "No data" message: err.message || "Some error occurred while inserting statements." ,'data': "No data"

4509
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,6 @@
"sequelize": "^6.6.5", "sequelize": "^6.6.5",
"swagger-jsdoc": "^6.1.0", "swagger-jsdoc": "^6.1.0",
"swagger-ui-express": "^4.1.6", "swagger-ui-express": "^4.1.6",
"sync": "^0.2.5",
"winston": "^3.3.3", "winston": "^3.3.3",
"winston-daily-rotate-file": "^4.5.5" "winston-daily-rotate-file": "^4.5.5"
}, },