-
Notifications
You must be signed in to change notification settings - Fork 1
Add Endpoint for Open Venues #1971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add Endpoint for Open Venues #1971
Conversation
…ithub.com:Samfundet/Samfundet4 into Eilif/1942-get-opening-hours-for-homepage-backend
Madt2
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Would it be better if closed venues was displayed as closed rather than removed from the list of opening hours?
| isLoading, | ||
| isError, | ||
| } = useQuery<VenueDto[]>({ | ||
| queryKey: ['openVenues'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Om jeg forsto koden riktig, så er denne queryKey ikke sentralisert som det står at vi bør følge fra dokumentet data-fetching.md:
Since it's extremely important that the query keys are unique, we employ a 'query key factory' to generate them for us. The factories are all defined in one place (queryKeys.ts), which should eliminate the possibility of key collisions.
Du bør derfor legge inn denne som en query key i queryKeys.ts. Du kan eksempel legge til i nøkkelen venueKeys en funksjon open: () => [...venueKeys.all, 'open'] as const, eller noe. Etter det kan du gjøre om denne linjen til: queryKey: venueKeys.open,.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think i've done it correctly now.
…EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
This PR adds endpoint for Open Venues. This endpoint is then used in the OpeningHoursContainer. OpeningHours.tsx is changed to reflect the use of VenueDto.
https://linear.app/mgweb/issue/WEB-51/add-endpoint-for-open-venues
This PR can be tested by adding the OpeningHoursContainer somewhere into your page of choice (probably HomePage) and modifying opening hours in the Django Admin Panel. 00:00:00 as opening and closing should result in a closed day, and should not be displayed in the component on that day.