mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-06-20 08:35:17 +00:00
Get the number of unread conversations of the user
This commit is contained in:
@ -393,6 +393,22 @@ export class ConversationsHelper {
|
||||
return result.map(r => r.conv_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count the number of unread conversations of the user
|
||||
*
|
||||
* @param userID Target user ID
|
||||
*/
|
||||
public static async CountUnreadForUser(userID: number) : Promise<number> {
|
||||
return await DatabaseHelper.Count({
|
||||
table: USERS_TABLE,
|
||||
where: {
|
||||
user_id: userID,
|
||||
saw_last_message: 0,
|
||||
following: 1
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of members of a conversation
|
||||
*
|
||||
|
Reference in New Issue
Block a user