mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-07-16 06:38:04 +00:00
Can refresh conversation messages
This commit is contained in:
src
@ -255,6 +255,24 @@ export class ConversationsHelper {
|
||||
},
|
||||
limit: numberOfMessages,
|
||||
order: "id DESC"
|
||||
})).map(m => this.DBToConversationMessage(convID, m)).reverse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the new messages of a conversation
|
||||
*
|
||||
* @param convID Target conversation ID
|
||||
* @param lastMessageID The ID of the last known message
|
||||
*/
|
||||
public static async GetNewMessages(convID: number, lastMessageID: number): Promise<Array<ConversationMessage>> {
|
||||
return (await DatabaseHelper.Query({
|
||||
table: MESSAGES_TABLE,
|
||||
where: {
|
||||
conv_id: convID
|
||||
},
|
||||
customWhere: "ID > ?",
|
||||
customWhereArgs: [lastMessageID.toString()],
|
||||
order: "id"
|
||||
})).map(m => this.DBToConversationMessage(convID, m));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user