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:
@ -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
|
||||
|
Reference in New Issue
Block a user