diff --git a/src/helpers/AccountHelper.ts b/src/helpers/AccountHelper.ts index 23fc5d0..f9e5d36 100644 --- a/src/helpers/AccountHelper.ts +++ b/src/helpers/AccountHelper.ts @@ -469,6 +469,9 @@ export class AccountHelper { // Delete all the notifications related with the user await NotificationsHelper.DeleteAllRelatedWithUser(userID); + + // Delete all user friends, including friendship requests + await FriendsHelper.DeleteAllUser(userID); */ // TODO : continue work diff --git a/src/helpers/FriendsHelper.ts b/src/helpers/FriendsHelper.ts index 046bf75..3631d59 100644 --- a/src/helpers/FriendsHelper.ts +++ b/src/helpers/FriendsHelper.ts @@ -329,6 +329,21 @@ export class FriendsHelper { return result["autoriser_post_page"] == 1; } + /** + * Delete all the friends of a given user + * + * @param userID Target user ID + */ + public static async DeleteAllUser(userID: number) { + await DatabaseHelper.DeleteRows(FRIENDS_TABLE, { + ID_personne: userID + }) + + await DatabaseHelper.DeleteRows(FRIENDS_TABLE, { + ID_amis: userID + }) + } + /** * Turn a database entry into a {Friend} object *