fin_insert:GWM

This commit is contained in:
sriramv 2021-08-24 10:12:58 +05:30
parent eecf82ce18
commit 4d9d9399bb
3 changed files with 22 additions and 2 deletions

View File

@ -172,5 +172,21 @@ exports.BrokenPeriods = (req, res) => {
exports.createFinancials = (req, res) => {
let req_array_data = req.body;
req_array_data.forEach((value, key)=>{
Financials.update({ is_active : 0 },{ where: { id: value.id }});
delete value.id;
});
Financials.bulkCreate(req_array_data)
.then(data => {
res.send({'status':200,'message':"success",'data':data});
logMsg.info("Success :"(data));
})
.catch(err => {
res.status(500).send({'status':404,
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
});
});
};

View File

@ -21,6 +21,7 @@ module.exports = (sequelize, DataTypes) => {
fy: { type: DataTypes.STRING },
st_type:{ type: DataTypes.STRING },
itemid: { type: DataTypes.INTEGER },
is_active: { type: DataTypes.INTEGER },
value: { type: DataTypes.INTEGER },
createdby: { type: DataTypes.INTEGER },
updatedby: { type: DataTypes.INTEGER },

View File

@ -27,8 +27,11 @@ module.exports = app => {
// Retrieve all Broken periods
router.get("/BrokenPeriodsList/:entityid", financials.BrokenPeriodsList);
// fetchind all master data
// fetching all master data
router.get("/MasterDatas", financials.MasterDatas);
// create financials data
router.post("/createFinancials", financials.createFinancials);
//master.controller api's