Surya: Filter Api
This commit is contained in:
parent
6a099d7dc5
commit
5ab22f5d2b
@ -322,6 +322,21 @@ exports.Deleteitem = (req, res) => {
|
||||
});
|
||||
};
|
||||
|
||||
//ItemFilter
|
||||
// Retrieve all items from the database which is under by the represent section.
|
||||
exports.ItemFilter = (req, res) => {
|
||||
const section = req.params.section
|
||||
Itemsmaster.findAll({where : { section : section }})
|
||||
// sequelize.query("SELECT itemsmaster.id,itemsmaster.statement as statement_id,statementsmaster.statement,itemsmaster.section as section_id,sectionsmaster.section,itemsmaster.subsection as subsection_id,subsectionsmaster.subsection,subsectionsmaster.itemtext as subsection_itemtext ,itemsmaster.itemtext,itemsmaster.is_active,pvtltd,llp,others,formula,is_calculated,itemsmaster.createdby,itemsmaster.createdon,itemsmaster.updatedby,itemsmaster.updatedon FROM itemsmaster JOIN statementsmaster ON itemsmaster.statement=statementsmaster.id JOIN sectionsmaster ON itemsmaster.section= sectionsmaster.id JOIN subsectionsmaster ON itemsmaster.subsection= subsectionsmaster.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 retrieving items." ,'data': "No data" });
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
@ -211,6 +211,16 @@ module.exports = app => {
|
||||
//router.delete("/:id", tutorials.delete);
|
||||
|
||||
|
||||
/**
|
||||
* @openapi
|
||||
* /api/ItemList:
|
||||
* get:
|
||||
* description: Welcome to swagger-jsdoc!
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Returns a mysterious string.
|
||||
*/
|
||||
router.get("/ItemFilter/:section", master.ItemFilter);
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user