replace ascending with descending

This commit is contained in:
m5r 2021-08-13 23:54:13 +08:00
parent 800ff5ab99
commit 5d5195fd9f
3 changed files with 3 additions and 3 deletions

View File

@ -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) => {

View File

@ -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<string, Message[]> = {};

View File

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