merging
This commit is contained in:
commit
1e61a0b49d
@ -9,7 +9,7 @@ const { logMsg } = require('../services/logger.js');
|
|||||||
//statementmaster
|
//statementmaster
|
||||||
|
|
||||||
// Retrieve all statements from the database.
|
// Retrieve all statements from the database.
|
||||||
exports.StatmentList = (req, res) => {
|
exports.StatementsList = (req, res) => {
|
||||||
|
|
||||||
Statementsmaster.findAll({where : { is_active : 1 } })
|
Statementsmaster.findAll({where : { is_active : 1 } })
|
||||||
.then(data => {
|
.then(data => {
|
||||||
@ -17,7 +17,7 @@ exports.StatmentList = (req, res) => {
|
|||||||
logMsg.info("Success :"(data));
|
logMsg.info("Success :"(data));
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
res.status(500).send({'status':404,
|
res.send({'status':404,
|
||||||
message: err.message || "Some error occurred while retrieving statements." ,'data': "No data" });
|
message: err.message || "Some error occurred while retrieving statements." ,'data': "No data" });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -52,18 +52,12 @@ exports.Updatestatement = (req, res) => {
|
|||||||
Statementsmaster.update(req.body, {
|
Statementsmaster.update(req.body, {
|
||||||
where: { id: id }
|
where: { id: id }
|
||||||
})
|
})
|
||||||
.then(num => {
|
.then(data => {
|
||||||
if (num == 1) {
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
res.send({'status':200,'message':"success",'data':data});
|
||||||
logMsg.info("Success :"(data));
|
logMsg.info("Success :"(data));
|
||||||
} else {
|
|
||||||
res.send({
|
|
||||||
message: `Cannot update statement with id= ${id}. Maybe statement was not found or req.body is empty!`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
res.status(500).send({'status':404,
|
res.send({'status':404,
|
||||||
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -76,21 +70,15 @@ exports.Deletestatement = (req, res) => {
|
|||||||
Statementsmaster.update({ is_active : 0 },{
|
Statementsmaster.update({ is_active : 0 },{
|
||||||
where: { id: id }
|
where: { id: id }
|
||||||
})
|
})
|
||||||
.then(num => {
|
.then(data => {
|
||||||
if (num == 1) {
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
res.send({'status':200,'message':"success",'data':data});
|
||||||
logMsg.info("Success :"(data));
|
logMsg.info("Success :"(data));
|
||||||
} else {
|
|
||||||
res.send({
|
|
||||||
message: `Cannot delete statement with id=${id}. Maybe statement was not found!`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
res.status(500).send({'status':404,
|
res.send({'status':404,
|
||||||
message: err.message || "Some error occurred while Deletiing statements." ,'data': "No data"
|
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -105,7 +93,7 @@ exports.SectionList = (req, res) => {
|
|||||||
logMsg.info("Success :"(data));
|
logMsg.info("Success :"(data));
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
res.status(500).send({'status':404,
|
res.send({'status':404,
|
||||||
message: err.message || "Some error occurred while retrieving sections." ,'data': "No data" });
|
message: err.message || "Some error occurred while retrieving sections." ,'data': "No data" });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -127,7 +115,7 @@ exports.Insertsection = (req, res) => {
|
|||||||
logMsg.info("Success :"(data));
|
logMsg.info("Success :"(data));
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
res.status(500).send({'status':404,
|
res.send({'status':404,
|
||||||
message: err.message || "Some error occurred while insertinging sectino." ,'data': "No data"
|
message: err.message || "Some error occurred while insertinging sectino." ,'data': "No data"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -139,21 +127,15 @@ exports.Updatesection = (req, res) => {
|
|||||||
Sectionsmaster.update(req.body, {
|
Sectionsmaster.update(req.body, {
|
||||||
where: { id: id }
|
where: { id: id }
|
||||||
})
|
})
|
||||||
.then(num => {
|
.then(data => {
|
||||||
if (num == 1) {
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
res.send({'status':200,'message':"success",'data':data});
|
||||||
logMsg.info("Success :"(data));
|
logMsg.info("Success :"(data));
|
||||||
} else {
|
|
||||||
res.send({
|
|
||||||
message: `Cannot update section with id=${id}. Maybe section was not found or req.body is empty!`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
res.status(500).send({'status':404,
|
res.send({'status':404,
|
||||||
message: err.message || "Some error occurred while updating sectinos." ,'data': "No data"
|
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
//delete
|
//delete
|
||||||
@ -163,21 +145,17 @@ exports.Deletesection = (req, res) => {
|
|||||||
Sectionsmaster.update({ is_active : 0 },{
|
Sectionsmaster.update({ is_active : 0 },{
|
||||||
where: { id: id }
|
where: { id: id }
|
||||||
})
|
})
|
||||||
.then(num => {
|
|
||||||
if (num == 1) {
|
.then(data => {
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
res.send({'status':200,'message':"success",'data':data});
|
||||||
logMsg.info("Success :"(data));
|
logMsg.info("Success :"(data));
|
||||||
} else {
|
|
||||||
res.send({
|
|
||||||
message: `Cannot delete section with id=${id}. Maybe section was not found!`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch(err => {
|
|
||||||
res.status(500).send({'status':404,
|
.catch(err => {
|
||||||
message: err.message || "Some error occurred while Deleting statements." ,'data': "No data"
|
res.send({'status':404,
|
||||||
});
|
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
||||||
});
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -192,7 +170,7 @@ exports.SubsectionList = (req, res) => {
|
|||||||
logMsg.info("Success :"(data));
|
logMsg.info("Success :"(data));
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
res.status(500).send({'status':404,
|
res.send({'status':404,
|
||||||
message: err.message || "Some error occurred while retrieving subsections." ,'data': "No data" });
|
message: err.message || "Some error occurred while retrieving subsections." ,'data': "No data" });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -215,7 +193,7 @@ exports.Insertsubsection = (req, res) => {
|
|||||||
logMsg.info("Success :"(data));
|
logMsg.info("Success :"(data));
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
res.status(500).send({'status':404,
|
res.send({'status':404,
|
||||||
message: err.message || "Some error occurred while insertinging subsection." ,'data': "No data"
|
message: err.message || "Some error occurred while insertinging subsection." ,'data': "No data"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -227,21 +205,16 @@ exports.Updatesubsection = (req, res) => {
|
|||||||
Subsectionsmaster.update(req.body, {
|
Subsectionsmaster.update(req.body, {
|
||||||
where: { id: id }
|
where: { id: id }
|
||||||
})
|
})
|
||||||
.then(num => {
|
.then(data => {
|
||||||
if (num == 1) {
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
res.send({'status':200,'message':"success",'data':data});
|
||||||
logMsg.info("Success :"(data));
|
logMsg.info("Success :"(data));
|
||||||
} else {
|
|
||||||
res.send({
|
|
||||||
message: `Cannot update subsection with id=${id}. Maybe subsection was not found or req.body is empty!`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
res.status(500).send({'status':404,
|
res.send({'status':404,
|
||||||
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//delete
|
//delete
|
||||||
@ -251,21 +224,15 @@ exports.Deletesubsection = (req, res) => {
|
|||||||
Subsectionsmaster.update({ is_active : 0 },{
|
Subsectionsmaster.update({ is_active : 0 },{
|
||||||
where: { id: id }
|
where: { id: id }
|
||||||
})
|
})
|
||||||
.then(num => {
|
.then(data => {
|
||||||
if (num == 1) {
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
res.send({'status':200,'message':"success",'data':data});
|
||||||
logMsg.info("Success :"(data));
|
logMsg.info("Success :"(data));
|
||||||
} else {
|
|
||||||
res.send({
|
|
||||||
message: `Cannot delete subsection with id=${id}. Maybe subsection was not found!`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
res.status(500).send({'status':404,
|
res.send({'status':404,
|
||||||
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -279,7 +246,7 @@ exports.ItemList = (req, res) => {
|
|||||||
logMsg.info("Success :"(data));
|
logMsg.info("Success :"(data));
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
res.status(500).send({'status':404,
|
res.send({'status':404,
|
||||||
message: err.message || "Some error occurred while retrieving items." ,'data': "No data" });
|
message: err.message || "Some error occurred while retrieving items." ,'data': "No data" });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -308,7 +275,7 @@ exports.Insertitem = (req, res) => {
|
|||||||
logMsg.info("Success :"(data));
|
logMsg.info("Success :"(data));
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
res.status(500).send({'status':404,
|
res.send({'status':404,
|
||||||
message: err.message || "Some error occurred while insertinging items." ,'data': "No data"
|
message: err.message || "Some error occurred while insertinging items." ,'data': "No data"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -320,21 +287,15 @@ exports.Updateitem = (req, res) => {
|
|||||||
Itemsmaster.update(req.body, {
|
Itemsmaster.update(req.body, {
|
||||||
where: { id: id }
|
where: { id: id }
|
||||||
})
|
})
|
||||||
.then(num => {
|
.then(data => {
|
||||||
if (num == 1) {
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
res.send({'status':200,'message':"success",'data':data});
|
||||||
logMsg.info("Success :"(data));
|
logMsg.info("Success :"(data));
|
||||||
} else {
|
|
||||||
res.send({
|
|
||||||
message: `Cannot update item with id=${id}. Maybe item was not found or req.body is empty!`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
res.status(500).send({'status':404,
|
res.send({'status':404,
|
||||||
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
//delete
|
//delete
|
||||||
@ -344,21 +305,15 @@ exports.Deleteitem = (req, res) => {
|
|||||||
Itemsmaster.update({ is_active : 0 },{
|
Itemsmaster.update({ is_active : 0 },{
|
||||||
where: { id: id }
|
where: { id: id }
|
||||||
})
|
})
|
||||||
.then(num => {
|
.then(data => {
|
||||||
if (num == 1) {
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
res.send({'status':200,'message':"success",'data':data});
|
||||||
logMsg.info("Success :"(data));
|
logMsg.info("Success :"(data));
|
||||||
} else {
|
|
||||||
res.send({
|
|
||||||
message: `Cannot delete item with id=${id}. Maybe statement was not found!`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
res.status(500).send({'status':404,
|
res.send({'status':404,
|
||||||
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
message: err.message || "Some error occurred while updating statements." ,'data': "No data"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -41,7 +41,10 @@ module.exports = app => {
|
|||||||
* 200:
|
* 200:
|
||||||
* description: Returns a mysterious string.
|
* description: Returns a mysterious string.
|
||||||
*/
|
*/
|
||||||
router.get("/StatementsList", master.StatmentList);
|
|
||||||
|
router.get("/StatementsList", master.StatementsList);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @openapi
|
||||||
* /api/Insertstatement:
|
* /api/Insertstatement:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user