Surya:itemmaster,sectionmaster,subsectionmaster apis added

This commit is contained in:
surya 2021-08-14 14:28:22 +05:30
parent 253c81a2c2
commit edd6572bee
4 changed files with 23 additions and 18 deletions

View File

@ -11,7 +11,7 @@ const { logMsg } = require('../services/logger.js');
// Retrieve all statementmaster from the database.
exports.StatmentList = (req, res) => {
Statementsmaster.findAll()
Statementsmaster.findAll({where : { is_active : 1 } })
.then(data => {
res.send({'status':200,'message':"success",'data':data});
logMsg.info("Success :"(data));
@ -93,7 +93,7 @@ exports.Updatestatement = (req, res) => {
exports.Deletestatement = (req, res) => {
const id = req.params.id;
Statementsmaster.destroy({
Statementsmaster.update({ is_active : 0 },{
where: { id: id }
})
.then(num => {
@ -120,7 +120,7 @@ exports.Deletestatement = (req, res) => {
// Retrieve all Sectionsmaster from the database.
exports.SectionList = (req, res) => {
Sectionsmaster.findAll()
Sectionsmaster.findAll({where : { is_active : 1 } })
.then(data => {
res.send({'status':200,'message':"success",'data':data});
logMsg.info("Success :"(data));
@ -182,7 +182,7 @@ exports.Updatesection = (req, res) => {
exports.Deletesection = (req, res) => {
const id = req.params.id;
Sectionsmaster.destroy({
Sectionsmaster.update({ is_active : 0 },{
where: { id: id }
})
.then(num => {
@ -209,7 +209,7 @@ exports.Deletesection = (req, res) => {
// Retrieve all Subsectionsmaster from the database.
exports.SubsectionList = (req, res) => {
Subsectionsmaster.findAll()
Subsectionsmaster.findAll({where : { is_active : 1 } })
.then(data => {
res.send({'status':200,'message':"success",'data':data});
logMsg.info("Success :"(data));
@ -272,7 +272,7 @@ exports.Updatesubsection = (req, res) => {
exports.Deletesubsection = (req, res) => {
const id = req.params.id;
Subsectionsmaster.destroy({
Subsectionsmaster.update({ is_active : 0 },{
where: { id: id }
})
.then(num => {
@ -298,7 +298,7 @@ exports.Deletesubsection = (req, res) => {
// Retrieve all itemsmaster from the database.
exports.ItemList = (req, res) => {
Itemsmaster.findAll()
Itemsmaster.findAll({where : { is_active : 1 } })
.then(data => {
res.send({'status':200,'message':"success",'data':data});
logMsg.info("Success :"(data));
@ -318,7 +318,7 @@ exports.Insertitem = (req, res) => {
itemtext: req.body.itemtext,
is_active: req.body.is_active,
pvt_ltd: req.body.pvt_ltd,
LLP: req.body.LLP,
llp: req.body.llp,
others: req.body.others,
formula: req.body.formula,
is_calculated: req.body.is_calculated,
@ -367,7 +367,7 @@ exports.Updateitem = (req, res) => {
exports.Deleteitem = (req, res) => {
const id = req.params.id;
Itemsmaster.destroy({
Itemsmaster.update({ is_active : 0 },{
where: { id: id }
})
.then(num => {

View File

@ -21,8 +21,8 @@ module.exports = (sequelize, DataTypes) => {
subsection: { type: DataTypes.INTEGER },
itemtext: { type: DataTypes.STRING },
is_active: { type: DataTypes.INTEGER },
pvt_ltd: { type: DataTypes.INTEGER },
LLP: { type: DataTypes.INTEGER },
pvtltd: { type: DataTypes.INTEGER },
llp: { type: DataTypes.INTEGER },
others: { type: DataTypes.INTEGER },
formula: { type: DataTypes.INTEGER },
is_calculated: { type: DataTypes.INTEGER },

View File

@ -17,13 +17,9 @@ module.exports = (sequelize, DataTypes) => {
}
Statementsmaster.init(
{
<<<<<<< HEAD
statement: { type: DataTypes.STRING },
is_active: { type: DataTypes.INTEGER },
=======
statement: { type: DataTypes.STRING },
is_active: { type: DataTypes.INTEGER },
>>>>>>> 58fe8288fbfafc85973b4d3718def076990ff1d2
createdby: { type: DataTypes.INTEGER },
updatedby: { type: DataTypes.INTEGER },

View File

@ -18,13 +18,22 @@ module.exports = app => {
router.get("/StatmentsList", master.StatmentList);
router.post("/Insertstatement", master.Insertstatement);
router.put("/Updatestatement/:id", master.Updatestatement);
router.delete("/Deletestatement/:id", master.Deletestatement);
router.put("/Deletestatement/:id", master.Deletestatement);
router.get("/SectionList", master.SectionList);
router.get("/Insertsection", master.Insertsection);
router.post("/Insertsection", master.Insertsection);
router.put("/Updatesection/:id", master.Updatesection);
router.put("/Deletesection/:id", master.Deletesection);
router.get("/SubsectionList", master.SubsectionList);
router.post("/Insertsubsection", master.Insertsubsection);
router.put("/Updatesubsection/:id", master.Updatesubsection);
router.put("/Deletesubsection/:id", master.Deletesubsection);
router.get("/ItemList", master.ItemList);
router.post("/Insertitem", master.Insertitem);
router.put("/Updateitem/:id", master.Updateitem);
router.put("/Deleteitem/:id", master.Deleteitem);
//sample
//router.put("/:id", tutorials.update);