1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-24 22:39:21 +00:00

Can delete all the notifications of a user

This commit is contained in:
Pierre HUBERT 2020-03-25 08:30:19 +01:00
parent 3bf3f18710
commit 50c6d8d0c2
3 changed files with 25 additions and 0 deletions

View File

@ -85,6 +85,18 @@ export class NotificationsController {
h.success()
}
/**
* Delete all the notifications of a specific user
*
* @param h Request handler
*/
public static async DeleteAll(h: RequestHandler) {
await NotificationsHelper.DeleteAllUser(h.getUserId());
h.success();
}
/**
* The the ID of a notification included in a request
*

View File

@ -264,6 +264,8 @@ export const Routes : Route[] = [
{path: "/notifications/mark_seen", cb: (h) => NotificationsController.MarkSeen(h)},
{path: "/notifications/delete_all", cb: (h) => NotificationsController.DeleteAll(h)},
// Movies controller

View File

@ -255,6 +255,17 @@ export class NotificationsHelper {
}
/**
* Delete all the notifications of a given user
*
* @param userID Target user ID
*/
public static async DeleteAllUser(userID: number) {
await this.Delete(new Notif({
destUserID: userID
}));
}
/**
* Count the number of unread notifications of a user
*