mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-19 20:02:20 -06:00
feat: Adds method to fetch contacts with last message
- Implements the `fetchContactsWithLastMessage` method in `ChatController` to retrieve contacts and their last messages. - Updates `ChatRouter` to include the new route that calls the above method. - Adds logic in `ChannelStartupService` to fetch contacts and their last messages, improving contact management functionality.
This commit is contained in:
@@ -253,6 +253,23 @@ export class ChatRouter extends RouterBroker {
|
||||
|
||||
return res.status(HttpStatus.OK).json(response);
|
||||
})
|
||||
.get(this.routerPath('fetchContactsWithLastMessage'), ...guards, async (req, res) => {
|
||||
logger.verbose('request received in fetchContactsWithLastMessage');
|
||||
logger.verbose('request body: ');
|
||||
logger.verbose(req.body);
|
||||
|
||||
logger.verbose('request query: ');
|
||||
logger.verbose(req.query);
|
||||
|
||||
const response = await this.dataValidate<InstanceDto>({
|
||||
request: req,
|
||||
schema: null,
|
||||
ClassRef: InstanceDto,
|
||||
execute: (instance) => chatController.fetchContactsWithLastMessage(instance),
|
||||
});
|
||||
|
||||
return res.status(HttpStatus.OK).json(response);
|
||||
})
|
||||
.post(this.routerPath('sendPresence'), ...guards, async (req, res) => {
|
||||
logger.verbose('request received in sendPresence');
|
||||
logger.verbose('request body: ');
|
||||
|
||||
Reference in New Issue
Block a user