diff --git a/src/helpers/AccountHelper.ts b/src/helpers/AccountHelper.ts index a9bdbf2..ae592d5 100644 --- a/src/helpers/AccountHelper.ts +++ b/src/helpers/AccountHelper.ts @@ -442,9 +442,13 @@ export class AccountHelper { */ public static async Delete(userID: number) { - // Delete all groups memberships + /*// Delete all groups memberships await GroupsHelper.DeleteAllUsersGroups(userID); - + + // Delete all user comments + await CommentsHelper.DeleteAllUser(userID); + */ + // TODO : continue work } diff --git a/src/helpers/CommentsHelper.ts b/src/helpers/CommentsHelper.ts index c9a4861..5a5c584 100644 --- a/src/helpers/CommentsHelper.ts +++ b/src/helpers/CommentsHelper.ts @@ -172,6 +172,16 @@ export class CommentsHelper { })).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 *