1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-07-17 15:18:05 +00:00

Can count all new elements

This commit is contained in:
2019-12-27 19:05:29 +01:00
parent 704e05bafe
commit b4c44fff1b
3 changed files with 51 additions and 0 deletions

@ -0,0 +1,29 @@
import { DatabaseHelper } from "./DatabaseHelper";
/**
* Friends helper
*
* @author Pierre HUBERT
*/
const FRIENDS_TABLE = "amis";
export class FriendsHelper {
/**
* Count the number of friendship requests a user
* received
*
* @param userID Target user ID
*/
public static async CountRequests(userID: number) : Promise<number> {
return await DatabaseHelper.Count({
table: FRIENDS_TABLE,
where: {
ID_personne: userID,
actif: 0
}
});
}
}