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

Delete all user friends

This commit is contained in:
Pierre HUBERT 2020-03-27 14:41:18 +01:00
parent aa9ae35ea3
commit 30740b8016
2 changed files with 18 additions and 0 deletions

View File

@ -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

View File

@ -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
*