1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-25 06:49:23 +00:00

Delete all the comments of the user

This commit is contained in:
Pierre HUBERT 2020-03-27 11:35:54 +01:00
parent d9248593e9
commit 15c2652b21
2 changed files with 16 additions and 2 deletions

View File

@ -442,9 +442,13 @@ export class AccountHelper {
*/ */
public static async Delete(userID: number) { public static async Delete(userID: number) {
// Delete all groups memberships /*// Delete all groups memberships
await GroupsHelper.DeleteAllUsersGroups(userID); await GroupsHelper.DeleteAllUsersGroups(userID);
// Delete all user comments
await CommentsHelper.DeleteAllUser(userID);
*/
// TODO : continue work // TODO : continue work
} }

View File

@ -172,6 +172,16 @@ export class CommentsHelper {
})).map((row) => this.DbToComment(row)); })).map((row) => this.DbToComment(row));
} }
/**
* Delete all the comment of a given user
*
* @param userID Target user id
*/
public static async DeleteAllUser(userID: number) {
for(const el of await this.ExportAllUser(userID))
await this.Delete(el);
}
/** /**
* Turn a database entry into a Comment object * Turn a database entry into a Comment object
* *