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

Can get a friendship status

This commit is contained in:
2019-12-31 10:33:38 +01:00
parent a78510d426
commit ca2e106852
3 changed files with 47 additions and 0 deletions

View File

@ -80,6 +80,23 @@ export class FriendsHelper {
return this.DbToFriend(result);
}
/**
* Check out whether a user sent a request to another friend
*
* @param userID The ID of the user supposed to have sent a request
* @param targetUser The ID of the target user
*/
public static async SentRequest(userID: number, targetUser: number) : Promise<boolean> {
return await DatabaseHelper.Count({
table: FRIENDS_TABLE,
where: {
ID_personne: targetUser,
ID_amis: userID,
actif: 0
}
}) > 0;
}
/**
* Count the number of friendship requests a user
* received