fix: admin org sorting (#2694)

This commit is contained in:
David Nguyen 2026-04-14 21:17:16 +10:00 committed by GitHub
parent 4935f387bf
commit bc82b2e70e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -120,14 +120,16 @@ export const findAdminOrganisations = async ({
};
}
const orderBy: Prisma.OrganisationOrderByWithRelationInput[] = query
? [{ subscription: { status: 'asc' } }, { name: 'asc' }]
: [{ createdAt: 'desc' }];
const [data, count] = await Promise.all([
prisma.organisation.findMany({
where: whereClause,
skip: Math.max(page - 1, 0) * perPage,
take: perPage,
orderBy: {
createdAt: 'desc',
},
orderBy,
select: {
id: true,
createdAt: true,