Surya:
This commit is contained in:
parent
2c4db899b0
commit
7329595c0f
@ -2,6 +2,8 @@
|
|||||||
//const Entities = db.tutorials;
|
//const Entities = db.tutorials;
|
||||||
//const Op = db.Sequelize.Op;
|
//const Op = db.Sequelize.Op;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const {sequelize , Statementsmaster ,Sectionsmaster , Subsectionsmaster,Itemsmaster } = require('../models')
|
const {sequelize , Statementsmaster ,Sectionsmaster , Subsectionsmaster,Itemsmaster } = require('../models')
|
||||||
const { logMsg } = require('../services/logger.js');
|
const { logMsg } = require('../services/logger.js');
|
||||||
|
|
||||||
@ -362,326 +364,6 @@ exports.Deleteitem = (req, res) => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//const db = require("../models");
|
|
||||||
//const Entities = db.tutorials;
|
|
||||||
//const Op = db.Sequelize.Op;
|
|
||||||
|
|
||||||
const { sequelize, Statementsmaster ,Sectionsmaster , Subsectionsmaster,Itemsmaster } = require('../models')
|
|
||||||
const { logMsg } = require('../services/logger.js');
|
|
||||||
|
|
||||||
|
|
||||||
//statementmaster
|
|
||||||
|
|
||||||
// Retrieve all statements from the database.
|
|
||||||
exports.StatementsList = (req, res) => {
|
|
||||||
|
|
||||||
Statementsmaster.findAll({where : { is_active : 1 } })
|
|
||||||
.then(data => {
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
|
||||||
logMsg.info("Success :"(data));
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
res.send({'status':404,
|
|
||||||
message: err.message || "Some error occurred while retrieving statements." ,'data': "No data" });
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
exports.Insertstatement = (req, res) => {
|
|
||||||
// Create a statement
|
|
||||||
const statement = {
|
|
||||||
statement: req.body.statement,
|
|
||||||
is_active: req.body.is_active,
|
|
||||||
createdby: req.body.createdby,
|
|
||||||
updatedby: req.body.updatedby,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Save Tutorial in the database
|
|
||||||
Statementsmaster.create(statement)
|
|
||||||
.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 insertinging statements." ,'data': "No data"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// updates datas into statementmaster table.
|
|
||||||
exports.Updatestatement = (req, res) => {
|
|
||||||
const id = req.params.id;
|
|
||||||
|
|
||||||
Statementsmaster.update(req.body, {
|
|
||||||
where: { id: id }
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
|
||||||
logMsg.info("Success :"(data));
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
res.send({'status':404,
|
|
||||||
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
//delete
|
|
||||||
exports.Deletestatement = (req, res) => {
|
|
||||||
const id = req.params.id;
|
|
||||||
|
|
||||||
Statementsmaster.update({ is_active : 0 },{
|
|
||||||
where: { id: id }
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
|
||||||
logMsg.info("Success :"(data));
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
res.send({'status':404,
|
|
||||||
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//Sectionsmaster
|
|
||||||
|
|
||||||
// Retrieve all Sectionsmaster from the database.
|
|
||||||
exports.SectionList = (req, res) => {
|
|
||||||
|
|
||||||
Sectionsmaster.findAll({where : { is_active : 1 } })
|
|
||||||
.then(data => {
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
|
||||||
logMsg.info("Success :"(data));
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
res.send({'status':404,
|
|
||||||
message: err.message || "Some error occurred while retrieving sections." ,'data': "No data" });
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.Insertsection = (req, res) => {
|
|
||||||
// Create a section
|
|
||||||
const section = {
|
|
||||||
statement: req.body.statement,
|
|
||||||
section: req.body.section,
|
|
||||||
is_active: req.body.is_active,
|
|
||||||
createdby: req.body.createdby,
|
|
||||||
updatedby: req.body.updatedby,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Save section in the database
|
|
||||||
Sectionsmaster.create(section)
|
|
||||||
.then(data => {
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
|
||||||
logMsg.info("Success :"(data));
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
res.send({'status':404,
|
|
||||||
message: err.message || "Some error occurred while insertinging sectino." ,'data': "No data"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.Updatesection = (req, res) => {
|
|
||||||
const id = req.params.id;
|
|
||||||
|
|
||||||
Sectionsmaster.update(req.body, {
|
|
||||||
where: { id: id }
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
|
||||||
logMsg.info("Success :"(data));
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
res.send({'status':404,
|
|
||||||
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
//delete
|
|
||||||
exports.Deletesection = (req, res) => {
|
|
||||||
const id = req.params.id;
|
|
||||||
|
|
||||||
Sectionsmaster.update({ is_active : 0 },{
|
|
||||||
where: { id: id }
|
|
||||||
})
|
|
||||||
|
|
||||||
.then(data => {
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
|
||||||
logMsg.info("Success :"(data));
|
|
||||||
})
|
|
||||||
|
|
||||||
.catch(err => {
|
|
||||||
res.send({'status':404,
|
|
||||||
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Subsectionsmaster
|
|
||||||
// Retrieve all Subsectionsmaster from the database.
|
|
||||||
exports.SubsectionList = (req, res) => {
|
|
||||||
|
|
||||||
Subsectionsmaster.findAll({where : { is_active : 1 } })
|
|
||||||
.then(data => {
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
|
||||||
logMsg.info("Success :"(data));
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
res.send({'status':404,
|
|
||||||
message: err.message || "Some error occurred while retrieving subsections." ,'data': "No data" });
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.Insertsubsection = (req, res) => {
|
|
||||||
// Create a statement
|
|
||||||
const subsection = {
|
|
||||||
section: req.body.section,
|
|
||||||
subsection: req.body.subsection,
|
|
||||||
itemtext: req.body.itemtext,
|
|
||||||
is_active: req.body.is_active,
|
|
||||||
createdby: req.body.createdby,
|
|
||||||
updatedby: req.body.updatedby,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Save Tutorial in the database
|
|
||||||
Subsectionsmaster.create(subsection)
|
|
||||||
.then(data => {
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
|
||||||
logMsg.info("Success :"(data));
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
res.send({'status':404,
|
|
||||||
message: err.message || "Some error occurred while insertinging subsection." ,'data': "No data"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.Updatesubsection = (req, res) => {
|
|
||||||
const id = req.params.id;
|
|
||||||
|
|
||||||
Subsectionsmaster.update(req.body, {
|
|
||||||
where: { id: id }
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
|
||||||
logMsg.info("Success :"(data));
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
res.send({'status':404,
|
|
||||||
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
//delete
|
|
||||||
exports.Deletesubsection = (req, res) => {
|
|
||||||
const id = req.params.id;
|
|
||||||
|
|
||||||
Subsectionsmaster.update({ is_active : 0 },{
|
|
||||||
where: { id: id }
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
|
||||||
logMsg.info("Success :"(data));
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
res.send({'status':404,
|
|
||||||
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//itemsmaster
|
|
||||||
// Retrieve all itemsmaster from the database.
|
|
||||||
exports.ItemList = (req, res) => {
|
|
||||||
|
|
||||||
Itemsmaster.findAll({where : { is_active : 1 } })
|
|
||||||
.then(data => {
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
|
||||||
logMsg.info("Success :"(data));
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
res.send({'status':404,
|
|
||||||
message: err.message || "Some error occurred while retrieving items." ,'data': "No data" });
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.Insertitem = (req, res) => {
|
|
||||||
// Create a item
|
|
||||||
const item = {
|
|
||||||
statement: req.body.statement,
|
|
||||||
section: req.body.section,
|
|
||||||
subsection: req.body.subsection,
|
|
||||||
itemtext: req.body.itemtext,
|
|
||||||
is_active: req.body.is_active,
|
|
||||||
pvt_ltd: req.body.pvt_ltd,
|
|
||||||
llp: req.body.llp,
|
|
||||||
others: req.body.others,
|
|
||||||
formula: req.body.formula,
|
|
||||||
is_calculated: req.body.is_calculated,
|
|
||||||
createdby: req.body.createdby,
|
|
||||||
updatedby: req.body.updatedby,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Save Tutorial in the database
|
|
||||||
Itemsmaster.create(item)
|
|
||||||
.then(data => {
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
|
||||||
logMsg.info("Success :"(data));
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
res.send({'status':404,
|
|
||||||
message: err.message || "Some error occurred while insertinging items." ,'data': "No data"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.Updateitem = (req, res) => {
|
|
||||||
const id = req.params.id;
|
|
||||||
|
|
||||||
Itemsmaster.update(req.body, {
|
|
||||||
where: { id: id }
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
|
||||||
logMsg.info("Success :"(data));
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
res.send({'status':404,
|
|
||||||
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
//delete
|
|
||||||
exports.Deleteitem = (req, res) => {
|
|
||||||
const id = req.params.id;
|
|
||||||
|
|
||||||
Itemsmaster.update({ is_active : 0 },{
|
|
||||||
where: { id: id }
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
|
||||||
logMsg.info("Success :"(data));
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
res.send({'status':404,
|
|
||||||
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user