From 6bf4109465311dc04b2aa50f38dbd79e83e820d9 Mon Sep 17 00:00:00 2001 From: CyberL1 Date: Mon, 29 Sep 2025 10:17:42 +0200 Subject: [PATCH] fix: set DESC order --- src/api/routes/channels/#channel_id/messages/pins/index.ts | 2 ++ src/api/routes/channels/#channel_id/pins.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/api/routes/channels/#channel_id/messages/pins/index.ts b/src/api/routes/channels/#channel_id/messages/pins/index.ts index 651a140e..da8ba842 100644 --- a/src/api/routes/channels/#channel_id/messages/pins/index.ts +++ b/src/api/routes/channels/#channel_id/messages/pins/index.ts @@ -58,6 +58,7 @@ router.put( const pinned_count = await Message.count({ where: { channel: { id: channel_id }, pinned_at: Not(IsNull()) }, + order: { pinned_at: "DESC" }, }); const { maxPins } = Config.get().limits.channel; @@ -184,6 +185,7 @@ router.get( const pins = await Message.find({ where: { channel_id: channel_id, pinned_at: Not(IsNull()) }, relations: ["author"], + order: { pinned_at: "DESC" }, }); const items = pins.map((message: Message) => ({ diff --git a/src/api/routes/channels/#channel_id/pins.ts b/src/api/routes/channels/#channel_id/pins.ts index c45c8853..8c4ee10d 100644 --- a/src/api/routes/channels/#channel_id/pins.ts +++ b/src/api/routes/channels/#channel_id/pins.ts @@ -59,6 +59,7 @@ router.put( const pinned_count = await Message.count({ where: { channel: { id: channel_id }, pinned_at: Not(IsNull()) }, + order: { pinned_at: "DESC" }, }); const { maxPins } = Config.get().limits.channel; @@ -185,6 +186,7 @@ router.get( const pins = await Message.find({ where: { channel_id: channel_id, pinned_at: Not(IsNull()) }, relations: ["author"], + order: { pinned_at: "DESC" }, }); res.send(pins);