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:
src
29
src/helpers/FriendsHelper.ts
Normal file
29
src/helpers/FriendsHelper.ts
Normal file
@ -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
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user