log_for_image_reinsert_api:GWM

This commit is contained in:
sriramv 2023-03-02 16:47:19 +05:30
parent f028c85be5
commit 77d4d7e445

View File

@ -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);}
});