diff --git a/src/routes/notification.js b/src/routes/notification.js index 8e37e7ed2ca3053ab24e47d88c32c06566a5cd7a..0ee451288986fe2436c6f1fcd55010b948dde786 100644 --- a/src/routes/notification.js +++ b/src/routes/notification.js @@ -18,7 +18,7 @@ router.get("/info/:id", async (req,res) =>{ // grab the userid // retrieve all the notifcations stored in the database try{ - const notifications = await Notification.find({userid:req.params.id}); + const notifications = await Notification.find({user_id:req.params.id}); res.status(200).send(notifications); }catch(error){ res.status(500).send(error); @@ -50,7 +50,7 @@ router.get("/info/:id", async (req,res) =>{ // grab the user id // delete on the database try{ - const notifications = await Notification.deleteMany({userid:req.params.id}) + const notifications = await Notification.deleteMany({user_id:req.params.id}) if(!notifications){ return res.status(404).send(); } @@ -69,7 +69,7 @@ router.get("/info/:id", async (req,res) =>{ //const notifications = new Notification(req.body); const date = new Date; - const notifications = new Notification({ userid: req.body['userid'], title: req.body['title'], description: req.body['description'], date: date }); + const notifications = new Notification({ user_id: req.body['user_id'], title: req.body['title'], description: req.body['description'], date: date }); try{ await notifications.save(); diff --git a/src/schema/schema.js b/src/schema/schema.js index 60ebea452993b7aeebc4cebf0802266e3e64c968..a38206ecdf221503fb89872c838432dc5a1957e9 100644 --- a/src/schema/schema.js +++ b/src/schema/schema.js @@ -1,7 +1,7 @@ const mongoose = require('mongoose'); const notificationSchema = new mongoose.Schema({ - userid: String, + user_id: String, title: String, description: String, date: Date