replace ascending with descending
This commit is contained in:
parent
800ff5ab99
commit
5d5195fd9f
@ -16,7 +16,7 @@ export default resolver.pipe(resolver.zod(GetConversations), resolver.authorize(
|
|||||||
|
|
||||||
const conversation = await db.message.findMany({
|
const conversation = await db.message.findMany({
|
||||||
where: { OR: [{ from: recipient }, { to: recipient }] },
|
where: { OR: [{ from: recipient }, { to: recipient }] },
|
||||||
orderBy: { sentAt: Prisma.SortOrder.asc },
|
orderBy: { sentAt: Prisma.SortOrder.desc },
|
||||||
});
|
});
|
||||||
|
|
||||||
return conversation.map((message) => {
|
return conversation.map((message) => {
|
||||||
|
@ -22,7 +22,7 @@ export default resolver.pipe(
|
|||||||
const phoneNumberId = organization.phoneNumbers[0]!.id;
|
const phoneNumberId = organization.phoneNumbers[0]!.id;
|
||||||
const messages = await db.message.findMany({
|
const messages = await db.message.findMany({
|
||||||
where: { organizationId, phoneNumberId },
|
where: { organizationId, phoneNumberId },
|
||||||
orderBy: { sentAt: Prisma.SortOrder.asc },
|
orderBy: { sentAt: Prisma.SortOrder.desc },
|
||||||
});
|
});
|
||||||
|
|
||||||
let conversations: Record<string, Message[]> = {};
|
let conversations: Record<string, Message[]> = {};
|
||||||
|
@ -11,6 +11,6 @@ export default resolver.pipe(resolver.zod(Body), resolver.authorize(), async ({
|
|||||||
|
|
||||||
return db.phoneCall.findMany({
|
return db.phoneCall.findMany({
|
||||||
where: { organizationId, phoneNumberId },
|
where: { organizationId, phoneNumberId },
|
||||||
orderBy: { createdAt: Prisma.SortOrder.asc },
|
orderBy: { createdAt: Prisma.SortOrder.desc },
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user