Skip to content

Commit

Permalink
fix getCitiesWithPrivileges filter fn
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic Wrege committed Nov 13, 2023
1 parent 42f272a commit 48da9bb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions db/city.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,23 @@ export async function getCitiesWithPrivileges(): Promise<InboxCity[]> {
const resultList = await pocketBase
.collection("cityInbox")
.getFullList<InboxCity>({
filter: "approved=true && ((freeParking = true || parkingHours > 0) || untilMaxMarkingHour = true || useBusLane = true)",
filter: "approved=true",
expand: "city",
});
return resultList
.map(toRecordToInboxCity)
.filter((item) => item.approved);
.filter(({ approved }) => approved)
.filter(
({
freeParking,
parkingHours,
untilMaxMarkingHour,
useBusLane,
}) =>
(freeParking = true || parkingHours > 0) ||
untilMaxMarkingHour ||
useBusLane
);
} catch (error: Error | any) {
console.error("[getCityById]", error.message);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "parkfuchs",
"version": "1.6.0",
"version": "1.6.1",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down

0 comments on commit 48da9bb

Please sign in to comment.