From bde445859ab90c5a3ad75c13c2b58ec7b912cf98 Mon Sep 17 00:00:00 2001 From: Stuart Long Chay Boon Date: Wed, 19 Oct 2022 17:06:06 +0800 Subject: [PATCH] [offers][chore] return comments in reverse chronological order --- .../src/server/router/offers/offers-comments-router.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/portal/src/server/router/offers/offers-comments-router.ts b/apps/portal/src/server/router/offers/offers-comments-router.ts index 20c79248..2e6b9e38 100644 --- a/apps/portal/src/server/router/offers/offers-comments-router.ts +++ b/apps/portal/src/server/router/offers/offers-comments-router.ts @@ -25,15 +25,21 @@ export const offersCommentsRouter = createRouter() include: { user: true, }, + orderBy: { + createdAt: 'desc' + } }, replyingTo: true, user: true, }, + orderBy: { + createdAt: 'desc' + } }, }, where: { id: input.profileId, - }, + } }); const discussions: OffersDiscussion = {