1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-22 13:29:22 +00:00

Can check following status of a friend

This commit is contained in:
Pierre HUBERT 2019-12-31 10:26:19 +01:00
parent 2152511843
commit a78510d426

View File

@ -128,6 +128,24 @@ export class FriendsHelper {
}) > 0;
}
/**
* Check whether a user is following a friend or not
*
* @param userID The ID of the user supposed to following a friend
* @param friendID The target friend
*/
public static async IsFollowing(userID: number, friendID: number) : Promise<boolean> {
return await DatabaseHelper.Count({
table: FRIENDS_TABLE,
where: {
ID_personne: userID,
ID_amis: friendID,
actif: 1,
abonnement: 1
}
}) > 0;
}
/**
* Check out whether friendship allows to create posts or not
*