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
{
// 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) {

View File

@ -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);