diff --git a/src/helpers/FriendsHelper.ts b/src/helpers/FriendsHelper.ts index b29eff7..32a4ff5 100644 --- a/src/helpers/FriendsHelper.ts +++ b/src/helpers/FriendsHelper.ts @@ -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 { + 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 *