From 5f399b1d7b59182922d66e4662ffa5adceb1595e Mon Sep 17 00:00:00 2001 From: Bilaboz Date: Wed, 15 Nov 2023 19:57:38 +0100 Subject: [PATCH] fix last message of joined channels --- api/src/modules/chat/channels.service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/src/modules/chat/channels.service.ts b/api/src/modules/chat/channels.service.ts index 11cb151..5dcd985 100644 --- a/api/src/modules/chat/channels.service.ts +++ b/api/src/modules/chat/channels.service.ts @@ -303,7 +303,12 @@ export class ChannelsService { include: { channel: { include: { - messages: true, + messages: { + orderBy: { + id: 'desc', + }, + take: 1, + }, }, }, },