stkholder:GWM
This commit is contained in:
parent
f48f0413b7
commit
c8eb4145fe
@ -114,7 +114,7 @@ exports.PullSalesPdData = async (req, res) =>
|
|||||||
{
|
{
|
||||||
if(storeId) {
|
if(storeId) {
|
||||||
Object.assign(values, { pd_id: storeId.pd_id });
|
Object.assign(values, { pd_id: storeId.pd_id });
|
||||||
await ProductInformation.create( values).then((successData)=>{logMsg.info("ProductInformation insert success ,PdId= "+storeId.pd_id);}).catch((err)=>{ logMsg.info("BreifOfBusiness insert failed ,PdId= "+storeId.pd_id+" Error = "+err);});
|
await ProductInformation.create( values).then((successData)=>{logMsg.info("ProductInformation insert success ,PdId= "+storeId.pd_id);}).catch((err)=>{ logMsg.info("ProductInformation insert failed ,PdId= "+storeId.pd_id+" Error = "+err);});
|
||||||
}else{resolve(false)}
|
}else{resolve(false)}
|
||||||
}
|
}
|
||||||
else if (keys == 'section5') {
|
else if (keys == 'section5') {
|
||||||
@ -915,3 +915,103 @@ exports.PropertyInformationList = async (req, res) =>
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
exports.PullSalesPdshareholderData = async (req, res) =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
IfGeneralSectionDataExist = await GeneralSection.findOne({ where : { ref_no : req.body.pdid ,product:req.body.product,case_no :req.body.caseno, is_active : 1 }});
|
||||||
|
if(IfGeneralSectionDataExist)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var salesPD = new Promise(async(resolve, reject) => {
|
||||||
|
const tempData =JSON.parse(JSON.stringify(req.body.data));
|
||||||
|
logMsg.info("Insertion started for PdId(ref_no)= "+req.body.pdid);
|
||||||
|
var count = 0;
|
||||||
|
var storeId = IfGeneralSectionDataExist;
|
||||||
|
const len = Object.keys(tempData).length - 1;
|
||||||
|
for (const [keys, values] of Object.entries(tempData)) {
|
||||||
|
count++;
|
||||||
|
|
||||||
|
if (Array.isArray(values) == true )
|
||||||
|
{
|
||||||
|
|
||||||
|
values.forEach(async(values) => {
|
||||||
|
|
||||||
|
if (keys == 'section3') {
|
||||||
|
if(storeId) {
|
||||||
|
Object.assign(values, { pd_id: storeId.pd_id }); await DetailsOfKeyShareHolder.create( values).then((successData)=>{logMsg.info("DetailsOfKeyShareHolder insert success ,PdId= "+storeId.pd_id);}).catch((err)=>{ logMsg.info("DetailsOfKeyShareHolder insert failed ,PdId= "+storeId.pd_id+" Error = "+err);});
|
||||||
|
}else{resolve(false)}
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
if (keys == 'section3') { if(storeId) { Object.assign(values, { pd_id: storeId.pd_id }); await DetailsOfKeyShareHolder.create( values).then((successData)=>{logMsg.info("DetailsOfKeyShareHolder insert success ,PdId= "+storeId.pd_id);}).catch((err)=>{ logMsg.info("DetailsOfKeyShareHolder insert failed ,PdId= "+storeId.pd_id+" Error = "+err);}); }else{resolve(false)} };
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
if (len == count - 1 )
|
||||||
|
{
|
||||||
|
resolve();
|
||||||
|
|
||||||
|
}
|
||||||
|
} // end of for loop
|
||||||
|
|
||||||
|
}); // end of promise
|
||||||
|
salesPD.then(async(result) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
if(result == false)
|
||||||
|
{
|
||||||
|
res.send({'status':404,'message':"failed",'data':"No Data"});
|
||||||
|
}else{
|
||||||
|
logMsg.info("Insertion completed for PdId(ref_no)= "+req.body.pdid);
|
||||||
|
res.send({'status':200,'message':"success",'data':"No Data"});
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
});
|
||||||
|
|
||||||
|
}// end of if else condition
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} catch(err) {
|
||||||
|
res.send({'status':404,message: err.message || "Some error occurred while retrieving data." ,'data': "No data" });
|
||||||
|
} //end of try catch
|
||||||
|
|
||||||
|
};
|
||||||
@ -5,7 +5,7 @@ module.exports = app => {
|
|||||||
const SalesPdController = require("../controllers/salespd.controller.js");
|
const SalesPdController = require("../controllers/salespd.controller.js");
|
||||||
const { logMsg } = require('../services/logger.js');
|
const { logMsg } = require('../services/logger.js');
|
||||||
var router = require("express").Router();
|
var router = require("express").Router();
|
||||||
|
router.post('/PullSalesPdshareholderData',SalesPdController.PullSalesPdshareholderData);
|
||||||
/**
|
/**
|
||||||
* @swagger
|
* @swagger
|
||||||
* /api/demo:
|
* /api/demo:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user