sort by title and scroll landing

This commit is contained in:
ntr committed 2023-02-06 00:02:46 +11:00
1 parent c4cc12850d
commit 1ee8dbc749
2 files changed
+6 -3

No files matched your search

+4 -3
View File
@@ -21,11 +21,12 @@ export default function createPg(log: Log, prisma: PrismaClient) {
}
async function userWants(user: User) {
return prisma.want.findMany({
const wants = await prisma.want.findMany({
where: { userId: user.id },
include: { _count: { select: { offers: true }} },
orderBy: { offers: { _count: 'desc' } }
});
})
return _.sortBy(wants, w => `${w.data.artists_sort} - ${w.data.title}`);
}
async function userOffers(user: User) {