diff --git a/src/helpers/AccountHelper.ts b/src/helpers/AccountHelper.ts index 0317a42..31ae03c 100644 --- a/src/helpers/AccountHelper.ts +++ b/src/helpers/AccountHelper.ts @@ -459,8 +459,11 @@ export class AccountHelper { // Delete all user movies await MoviesHelper.DeleteAllUser(userID); - */ + // Delete conversation messages + await ConversationsHelper.DeleteAllUserMessages(userID); + */ + // TODO : continue work } diff --git a/src/helpers/ConversationsHelper.ts b/src/helpers/ConversationsHelper.ts index 58dc28f..0f1c157 100644 --- a/src/helpers/ConversationsHelper.ts +++ b/src/helpers/ConversationsHelper.ts @@ -380,6 +380,16 @@ export class ConversationsHelper { })).map(m => this.DBToConversationMessage(m.conv_id, m)); } + /** + * Delete all the messages of a given user + * + * @param userID Target user ID + */ + public static async DeleteAllUserMessages(userID: number) { + for(const msg of await this.ExportAllMessages(userID)) + await this.DeleteMessage(msg); + } + /** * Mark the user has seen the last messages of the conversation *