diff --git a/app/controllers/master.controller.js b/app/controllers/master.controller.js index 7e52caa..411b689 100644 --- a/app/controllers/master.controller.js +++ b/app/controllers/master.controller.js @@ -340,7 +340,7 @@ exports.ItemFilter = (req, res) => { }; -exports.createRemarkss = (req, res) => { +exports.createRemarks = (req, res) => { const req_array_data = req.body; try @@ -373,51 +373,7 @@ exports.createRemarkss = (req, res) => { } }; -exports.createRemarks = (req, res) => { - const obj = req.body - if (obj.hasOwnProperty("id")) - { - // update broken periods - const Id = req.body.id - Fin_remarks.update( { - entity_id: req.body.entity_id, - itemid: req.body.itemid, - remarks: req.body.remarks, - is_active: req.body.is_active, - createdby: req.body.createdby, - updatedby: req.body.updatedby, - } , { where: { id: Id } }) - .then(data => { - res.send({'status':200,'message':"success",'data':data}); - }) - .catch(err => { - res.status(404).send({'status':404, - message: err.message || "Some error occurred while insertinging statements." ,'data': "No data" - }); - }); - - } - else - { - // create broken period - Fin_remarks.create( { - entity_id: req.body.entity_id, - itemid: req.body.itemid, - remarks: req.body.remarks, - is_active: req.body.is_active, - createdby: req.body.createdby, - }) - .then(data => { - res.send({'status':200,'message':"success",'data':data}); - }) - .catch(err => { - res.status(404).send({'status':404, - message: err.message || "Some error occurred while insertinging statements." ,'data': "No data" - }); - }); - } - -}; + diff --git a/app/routes/routes.js b/app/routes/routes.js index e5a72c9..fbe4e58 100644 --- a/app/routes/routes.js +++ b/app/routes/routes.js @@ -644,11 +644,58 @@ module.exports = app => { * description: success */ // get financials summary - router.get("/ItemFilter/:section", master.ItemFilter); + router.get("/ItemFilter", master.ItemFilter); - router.post("/createRemarkss", master.createRemarkss); + /** + * @swagger + * definitions: + * remarks: + * type: object + * properties: + * entity_id: + * type: integer + * description: id of the entity + * example: 1 + * itemid: + * type: integer + * description: id of the item + * example: 1 + * remarks: + * type: string + * description: remarks + * example: testttttttttttttt + * is_active: + * type: integer + * description: the state of section(0 means inactive,1 means active) + * example: 1 + * createdby: + * type: integer + * description: The person who created + * example: 1 + * updatedby: + * type: integer + * description: The person who modified + * example: 1 + */ +/** + * @swagger + * /api/createRemarks: + * post: + * summary: create Remarks + * description: create Remarks + * requestBody: + * content: + * application/json: + * schema: + * $ref: '#/definitions/remarks' + * responses: + * 200: + * description: item created succesfully + * 500: + * description: failure in creating item + */ router.post("/createRemarks", master.createRemarks); - +