implemented pagination
This commit is contained in:
@@ -76,7 +76,13 @@ export const fetchAvailableYears = withUser(async (user:AuthenticatedUser) => {
|
||||
const dbClient = await getDbClient();
|
||||
|
||||
// query mnogodb for all `yearMonth` values
|
||||
const yearMonths = await dbClient.collection<BillingLocation>("lokacije").distinct("yearMonth.year", { userId });
|
||||
const years = await dbClient.collection<BillingLocation>("lokacije")
|
||||
.distinct("yearMonth.year", { userId })
|
||||
|
||||
return(yearMonths);
|
||||
// sort the years in descending order
|
||||
const sortedYears = years.sort((a, b) => b - a);
|
||||
|
||||
console.log("sortedYears", sortedYears);
|
||||
|
||||
return(sortedYears);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user