From 5d5195fd9f67546fac5dda91dac593dcadcf8fbb Mon Sep 17 00:00:00 2001 From: m5r Date: Fri, 13 Aug 2021 23:54:13 +0800 Subject: [PATCH] replace ascending with descending --- app/messages/queries/get-conversation.ts | 2 +- app/messages/queries/get-conversations.ts | 2 +- app/phone-calls/queries/get-phone-calls.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/messages/queries/get-conversation.ts b/app/messages/queries/get-conversation.ts index 61687bb..e5b7b01 100644 --- a/app/messages/queries/get-conversation.ts +++ b/app/messages/queries/get-conversation.ts @@ -16,7 +16,7 @@ export default resolver.pipe(resolver.zod(GetConversations), resolver.authorize( const conversation = await db.message.findMany({ where: { OR: [{ from: recipient }, { to: recipient }] }, - orderBy: { sentAt: Prisma.SortOrder.asc }, + orderBy: { sentAt: Prisma.SortOrder.desc }, }); return conversation.map((message) => { diff --git a/app/messages/queries/get-conversations.ts b/app/messages/queries/get-conversations.ts index cafa577..f690b43 100644 --- a/app/messages/queries/get-conversations.ts +++ b/app/messages/queries/get-conversations.ts @@ -22,7 +22,7 @@ export default resolver.pipe( const phoneNumberId = organization.phoneNumbers[0]!.id; const messages = await db.message.findMany({ where: { organizationId, phoneNumberId }, - orderBy: { sentAt: Prisma.SortOrder.asc }, + orderBy: { sentAt: Prisma.SortOrder.desc }, }); let conversations: Record = {}; diff --git a/app/phone-calls/queries/get-phone-calls.ts b/app/phone-calls/queries/get-phone-calls.ts index 822e805..2ebff75 100644 --- a/app/phone-calls/queries/get-phone-calls.ts +++ b/app/phone-calls/queries/get-phone-calls.ts @@ -11,6 +11,6 @@ export default resolver.pipe(resolver.zod(Body), resolver.authorize(), async ({ return db.phoneCall.findMany({ where: { organizationId, phoneNumberId }, - orderBy: { createdAt: Prisma.SortOrder.asc }, + orderBy: { createdAt: Prisma.SortOrder.desc }, }); });