diff --git a/src/routes/notification.js b/src/routes/notification.js index 7ddc61a01a3f1056577cd026d3006e720aa761ac..2c0849ee2c7b2545f42d098ed0ecdb492a1e8262 100644 --- a/src/routes/notification.js +++ b/src/routes/notification.js @@ -16,14 +16,18 @@ const Notification = require('../schema/schema') router.get("/info/:id",(req,res) =>{ - res.send("id") // grab the userid - const user_id =req.params.id; - // retrieve all the notifcations stored in the database - + Notification.findById(req.params.id).then((notifiaction) => { + if(!notifiaction){ + return res.status(404).send(); + } + res.send(notifiaction); + }).catch((error) => { + res.status(500).send(error); + }) // send the notifications to the notification page diff --git a/src/schema/schema.js b/src/schema/schema.js index 5031912c7e74e3418cb3ef2bbafc0e7ddfa462d3..9c3ed306d7b63180a18d0ec4e004ffd798c8aa85 100644 --- a/src/schema/schema.js +++ b/src/schema/schema.js @@ -1,6 +1,7 @@ const mongoose = require('mongoose'); const notificationSchema = new mongoose.Schema({ + userid:Number, title: String, description: String, date: Date