diff --git a/app/controllers/salespd.controller.js b/app/controllers/salespd.controller.js index e342ecb..552b83d 100644 --- a/app/controllers/salespd.controller.js +++ b/app/controllers/salespd.controller.js @@ -1060,10 +1060,10 @@ exports.ReInsertImageData = async (req, res) => if (Array.isArray(reqData.section9) == true ) { Photograph.destroy({ where: { pd_id: IfGeneralSectionDataExist.pd_id , ref_no :req.body.pdid} }).then(function(result) { - + logMsg.info("Photos count for pd_id (ref_no) = "+reqData.section9.length); reqData.section9.forEach(async(values,index,array) => { Object.assign(values, { pd_id: IfGeneralSectionDataExist.pd_id,ref_no:req.body.pdid }); - await Photograph.create( values).then((successData)=>{logMsg.info("Photograph insert success ,PdId= "+IfGeneralSectionDataExist.pd_id);}).catch((err)=>{ logMsg.info("Photograph insert failed ,PdId= "+IfGeneralSectionDataExist.pd_id+" Error = "+err);}); + await Photograph.create( values).then((successData)=>{logMsg.info("Photograph insert success name = "+values.img+", PdId = "+IfGeneralSectionDataExist.pd_id);}).catch((err)=>{ logMsg.info("Photograph insert failed name = "+values.img+", PdId = "+IfGeneralSectionDataExist.pd_id+" Error = "+err);}); if(array.length == index+1){resolve(true);} });