fixed result sorting

This commit is contained in:
2024-01-09 16:25:23 +01:00
parent d627ad757d
commit 8cbf254f38

View File

@@ -98,7 +98,11 @@ export const fetchAllLocations = withUser(async (user:AuthenticatedUser, pageIx:
// fetch `pageSize` locations for the given page index // fetch `pageSize` locations for the given page index
const locations = await dbClient.collection<BillingLocation>("lokacije") const locations = await dbClient.collection<BillingLocation>("lokacije")
.find({ userId }) .find({ userId })
.sort({ yearMonth: -1, name: 1 }) .sort({
"yearMonth.year": -1,
"yearMonth.month": -1,
name: 1,
})
.skip(pageIx * pageSize) .skip(pageIx * pageSize)
.limit(pageSize) .limit(pageSize)
.toArray(); .toArray();