feat: add plugins settings i18n + typing

This commit is contained in:
Mohamed Marrouchi
2024-10-19 13:56:09 +01:00
parent 8d846186cc
commit 92bb4978c3
20 changed files with 107 additions and 67 deletions

View File

@@ -116,4 +116,23 @@ export class MessageService extends BaseService<
limit,
);
}
/**
* Retrieves the latest messages for a given subscriber
*
* @param subscriber - The subscriber whose message history is being retrieved.
* @param limit - The maximum number of messages to return (defaults to 5).
*
* @returns The message history since the specified date.
*/
async findLastMessages(subscriber: Subscriber, limit: number = 5) {
const lastMessages = await this.findPage(
{
$or: [{ sender: subscriber.id }, { recipient: subscriber.id }],
},
{ sort: ['createdAt', 'desc'], skip: 0, limit },
);
return lastMessages.reverse();
}
}