deleteApi:GWM

This commit is contained in:
sriramv 2022-06-02 11:49:01 +05:30
parent 7454ef24f2
commit 674aa3dd60
2 changed files with 28 additions and 14 deletions

View File

@ -123,10 +123,13 @@ exports.deleteNotes = async (req, res) =>
{ {
try try
{ {
// update working notes data (is_active = 0) for (const value of req.body.id)
await Workingnotes.update({is_active: 0} , { where: { id: req.query.id } }) {
.then(data=>{ logMsg.info("Notes update Success");}) // update working notes data (is_active = 0)
.catch(err=>{ logMsg.info("Notes update Failed");}); 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"}); res.send({'status':200 , message:"Success." ,'data': "no data"});
} catch(err) { } catch(err) {

View File

@ -150,24 +150,35 @@ module.exports = app => {
router.post("/updateNotes", Notescontroller.updateNotes); router.post("/updateNotes", Notescontroller.updateNotes);
/**
* @swagger
* definitions:
* deleteNotes:
* type: object
* properties:
* id:
* type: array
* description: id of notes object
* example: []
*/
/** /**
* @swagger * @swagger
* /api/deleteNotes: * /api/deleteNotes:
* get: * post:
* summary: deactivate notes data * summary:
* description: * description:
* parameters: * requestBody:
* - in: query * content:
* name: id * application/json:
* schema: * schema:
* type: integer * $ref: '#/definitions/deleteNotes'
* required: true
* example:
* responses: * responses:
* 200: * 200:
* description: success * description: success
* 500:
* description: failed
*/ */
router.get("/deleteNotes", Notescontroller.deleteNotes); router.post("/deleteNotes", Notescontroller.deleteNotes);
// routes started here // routes started here
app.use('/api', router); app.use('/api', router);