From dd9c359d97a027f7d538f7ceba2d672f5b6d2219 Mon Sep 17 00:00:00 2001
From: Alan Chamathil <77508072+AlanChamathil@users.noreply.github.com>
Date: Mon, 27 Mar 2023 12:29:08 +0100
Subject: [PATCH] Added Delete method

---
 src/routes/notification.js | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/routes/notification.js b/src/routes/notification.js
index cc5c15f..e2fb9e2 100644
--- a/src/routes/notification.js
+++ b/src/routes/notification.js
@@ -35,19 +35,21 @@ router.get("/info/:id",(req,res) =>{
   })
   
   
-  router.delete("/delete",(req,res) =>{
-    
+  router.delete("/delete/:id",(req,res) =>{
+    //64216d2a4341c23ccfa83506
     // delete the notifications
-    // grab the user id and the notification id
-    const user_id = req.body['user_id'];
-    const notification_id= req.body['notification_id'];
-  
+    // grab the notification id
     // delete on the database
     
+    Notification.findByIdAndDelete(req.params.id).then((notifiaction) => {
+      if(!notifiaction){
+        return res.status(404).send();
+      }
+      res.send(notifiaction);
+    }).catch((error) => {
+      res.status(500).send(error);
+    })
 
-  
-  
-  
   })
   
   
-- 
GitLab