Skip to main content

Notification Routes

GET /api/notification/:user_id

Return an array of notifications of a user.

NameTypeDescription
Paramsuser_idStringJHED_ID
OutputNotification[]Empty if user_id is invalid or the user does not have any notifications.

Sample Output

[
{
"user_id": "qwu29",
"message": "You have created a plan!",
"quick_link_id": "61cd000b723b840004850eb5",
"link_type": "PLAN",
"read": false,
"date": "2021-12-31T00:40:43.334Z"
},
{
"user_id": "qwu29",
"message": "Welcome to uCredit!",
"read": true,
"date": "2021-12-30T22:43:08.305Z"
}
]

POST /api/notification

Creates a notification.

NameTypeDescription
Bodyuser_idStringJHED_ID
messageStringmessage to the user
quick_link_id(opt)Stringid of an object the message is referred to
link_type(opt)enum:["PLAN", "REVIEW", "USER"]
OutputNotificationCreated Notification with date as the current time and read as false.

Sample Output

{
"user_id": "qwu29",
"message": "You have created a plan!",
"quick_link_id": "61cd000b723b840004850eb5",
"link_type": "PLAN",
"read": false,
"date": "2021-12-31T00:40:43.334Z"
}

POST /api/notification/read/:notification_id

Change the status of the read field of a notification to true.

NameTypeDescription
Paramsnotification_idString
OutputNotificationread becomes true.

Sample Output

{
"user_id": "qwu29",
"message": "Welcome to uCredit!",
"read": true,
"date": "2021-12-30T22:43:08.305Z"
}

DELETE /api/notifications/:notification_id

Deletes a notification.

NameTypeDescription
Paramsnotification_idString
OutputNotification`The deleted notification object.

Sample Output

{
"user_id": "qwu29",
"message": "You have created a plan!",
"quick_link_id": "61cd000b723b840004850eb5",
"link_type": "PLAN",
"read": false,
"date": "2021-12-31T00:40:43.334Z"
}