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 }, }); });