mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-12-27 22:18:52 +00:00
Can delete all the notifications of a user
This commit is contained in:
parent
3bf3f18710
commit
50c6d8d0c2
@ -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
|
||||
*
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user