Skip to content

Conversation

@eilifhl
Copy link
Contributor

@eilifhl eilifhl commented Sep 25, 2025

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.

@eilifhl eilifhl self-assigned this Sep 25, 2025
@eilifhl eilifhl added frontend Task related to frontend. backend Task related to backend. labels Sep 25, 2025
@eilifhl eilifhl linked an issue Sep 25, 2025 that may be closed by this pull request
@eilifhl eilifhl marked this pull request as ready for review October 2, 2025 16:33
@hei98 hei98 self-requested a review October 7, 2025 18:08
Copy link

@Madt2 Madt2 left a 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'],
Copy link
Contributor

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,.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

226d5c0

I think i've done it correctly now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Task related to backend. frontend Task related to frontend. fullstack

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get opening hours for homepage backend

5 participants