1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-06-20 08:35:17 +00:00

Return the number of friends of the user

This commit is contained in:
2019-12-28 14:09:20 +01:00
parent a22f339a17
commit d1ea274281
2 changed files with 17 additions and 0 deletions

View File

@ -26,6 +26,21 @@ export class FriendsHelper {
});
}
/**
* Count the number of friends of a specific user
*
* @param userID Target user ID
*/
public static async CountForUser(userID: number) : Promise<number> {
return await DatabaseHelper.Count({
table: FRIENDS_TABLE,
where: {
ID_amis: userID,
actif: 1
}
});
}
/**
* Check out whether two users are friend or not
*