1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-12-26 13:38:52 +00:00

Can delete all the notifications related with a specified user

This commit is contained in:
Pierre HUBERT 2020-03-27 14:32:40 +01:00
parent 50a16c0f8c
commit aa9ae35ea3
2 changed files with 19 additions and 0 deletions

View File

@ -15,6 +15,7 @@ import { MoviesHelper } from "./MoviesHelper";
import { ConversationsHelper } from "./ConversationsHelper";
import { FriendsHelper } from "./FriendsHelper";
import { GroupsHelper } from "./GroupsHelper";
import { NotificationsHelper } from "./NotificationsHelper";
/**
* Account helper
@ -465,6 +466,9 @@ export class AccountHelper {
// Remove the user from all its conversations
await ConversationsHelper.DeleteAllUserConversations(userID);
// Delete all the notifications related with the user
await NotificationsHelper.DeleteAllRelatedWithUser(userID);
*/
// TODO : continue work

View File

@ -282,6 +282,21 @@ export class NotificationsHelper {
await this.Delete(n);
}
/**
* Delete all the notifications related with a specified user
*
* @param userID Target user ID
*/
public static async DeleteAllRelatedWithUser(userID: number) {
// Delete all the notifications targetting the user
await this.DeleteAllUser(userID);
// Delete all the notifications created by the user
await this.Delete(new Notif({
fromUserID: userID
}));
}
/**
* Count the number of unread notifications of a user
*