diff --git a/app/controllers/working.notes.controller.js b/app/controllers/working.notes.controller.js index 14aefd0..a7772ff 100644 --- a/app/controllers/working.notes.controller.js +++ b/app/controllers/working.notes.controller.js @@ -123,10 +123,13 @@ exports.deleteNotes = async (req, res) => { try { - // update working notes data (is_active = 0) - await Workingnotes.update({is_active: 0} , { where: { id: req.query.id } }) - .then(data=>{ logMsg.info("Notes update Success");}) - .catch(err=>{ logMsg.info("Notes update Failed");}); + for (const value of req.body.id) + { + // update working notes data (is_active = 0) + await Workingnotes.update({is_active: 0} , { where: { id: value } }) + .then(data=>{ logMsg.info("Notes is_active = 0 update Success");}) + .catch(err=>{ logMsg.info("Notes is_active = 0 update Failed");}); + } res.send({'status':200 , message:"Success." ,'data': "no data"}); } catch(err) { diff --git a/app/routes/routes.js b/app/routes/routes.js index 303b8fe..4a2016a 100644 --- a/app/routes/routes.js +++ b/app/routes/routes.js @@ -150,24 +150,35 @@ module.exports = app => { router.post("/updateNotes", Notescontroller.updateNotes); +/** +* @swagger +* definitions: +* deleteNotes: +* type: object +* properties: +* id: +* type: array +* description: id of notes object +* example: [] +*/ /** * @swagger * /api/deleteNotes: -* get: -* summary: deactivate notes data -* description: -* parameters: -* - in: query -* name: id +* post: +* summary: +* description: +* requestBody: +* content: +* application/json: * schema: -* type: integer -* required: true -* example: +* $ref: '#/definitions/deleteNotes' * responses: * 200: * description: success +* 500: +* description: failed */ -router.get("/deleteNotes", Notescontroller.deleteNotes); +router.post("/deleteNotes", Notescontroller.deleteNotes); // routes started here app.use('/api', router);