diff --git a/src/helpers/ConversationsHelper.ts b/src/helpers/ConversationsHelper.ts index 65791b3..c3894cb 100644 --- a/src/helpers/ConversationsHelper.ts +++ b/src/helpers/ConversationsHelper.ts @@ -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 { + return await DatabaseHelper.Count({ + table: USERS_TABLE, + where: { + conv_id: convID, + user_id: userID + } + }) == 1; + } + /** * Get the list of members of a conversation *