fix: add secondary sort to mii list api
This commit is contained in:
parent
783c5161c0
commit
b2fcf64f58
1 changed files with 2 additions and 1 deletions
|
|
@ -64,7 +64,8 @@ export async function GET(request: NextRequest) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Sorting by likes or newest
|
// Sorting by likes or newest
|
||||||
const orderBy: Prisma.MiiOrderByWithRelationInput = sort === "likes" ? { likedBy: { _count: "desc" } } : { createdAt: "desc" };
|
const orderBy: Prisma.MiiOrderByWithRelationInput[] =
|
||||||
|
sort === "likes" ? [{ likedBy: { _count: "desc" } }, { name: "asc" }] : [{ createdAt: "desc" }, { name: "asc" }];
|
||||||
|
|
||||||
const select: Prisma.MiiSelect = {
|
const select: Prisma.MiiSelect = {
|
||||||
id: true,
|
id: true,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue