1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-26 07:19:23 +00:00

Can check out whether a user belongs to a conversation or not

This commit is contained in:
Pierre HUBERT 2019-11-23 19:31:48 +01:00
parent 215bf1617d
commit 988d6d0936

View File

@ -51,6 +51,22 @@ export class ConversationsHelper {
} }
/**
* Check out whether a user is the member of a conversation or not
*
* @param userID Target user ID
* @param convID Target conversation
*/
public static async DoesUsersBelongsTo(userID: number, convID: number) : Promise<boolean> {
return await DatabaseHelper.Count({
table: USERS_TABLE,
where: {
conv_id: convID,
user_id: userID
}
}) == 1;
}
/** /**
* Get the list of members of a conversation * Get the list of members of a conversation
* *