From 9e7150645b6e1755b64d1404c09d3bfbd03f10ec Mon Sep 17 00:00:00 2001 From: Trivernis Date: Wed, 15 Jan 2020 15:58:43 +0100 Subject: [PATCH] Sort messages descending - Sort messages for chats in descending --- src/lib/models/ChatRoom.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/models/ChatRoom.ts b/src/lib/models/ChatRoom.ts index 6d84955..9d557d1 100644 --- a/src/lib/models/ChatRoom.ts +++ b/src/lib/models/ChatRoom.ts @@ -40,7 +40,7 @@ export class ChatRoom extends Model { public async messages({first, offset}: { first: number, offset: number }): Promise { const limit = first ?? 10; offset = offset ?? 0; - return await this.$get("rMessages", {limit, offset}) as ChatMessage[]; + return await this.$get("rMessages", {limit, offset, order: [["id", "DESC"]]}) as ChatMessage[]; } /**