From 77d4d7e4457deda97bb53002b68917df8113a9e2 Mon Sep 17 00:00:00 2001 From: sriramv Date: Thu, 2 Mar 2023 16:47:19 +0530 Subject: [PATCH] log_for_image_reinsert_api:GWM --- app/controllers/salespd.controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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);} });