diff --git a/src/helpers/ConversationsHelper.ts b/src/helpers/ConversationsHelper.ts index 3136e11..5a2c5a7 100644 --- a/src/helpers/ConversationsHelper.ts +++ b/src/helpers/ConversationsHelper.ts @@ -166,6 +166,22 @@ export class ConversationsHelper { }); } + /** + * Check out whether a user is the moderator of a conversation or not + * + * @param userID User to check + * @param convID Target conversation + */ + public static async IsUserModerator(userID : number, convID : number) : Promise { + return await DatabaseHelper.Count({ + table: USERS_TABLE, + where: { + id: convID, + user_id: userID + } + }) == 1; + } + /** * Get the list of members of a conversation *