Skip to content
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

add connection for first part of reservation system for lyche #947

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

magsyg
Copy link
Contributor

@magsyg magsyg commented Feb 2, 2024

Connects check reservation, and reservation form with backend

Does not allow for posting yet

@magsyg magsyg self-assigned this Feb 2, 2024
Comment on lines +33 to +35
if (data.biggest_table == 0) {
toast.error('Det eksisterer ingen bord i backend');
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Antar dette bare er er for testing?

@@ -236,6 +238,20 @@ export async function getEventGroups(): Promise<EventGroupDto[]> {
return response.data;
}

export async function getAvailableTimes(data: FetchAvailableTimesDto, pk?: number): Promise<string[]> {
Copy link
Member

Choose a reason for hiding this comment

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

pk først ser bedre ut

Copy link
Contributor

Choose a reason for hiding this comment

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

Skal ikke optional parametre være etter non-optional?

Copy link
Member

Choose a reason for hiding this comment

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

Hvorfor er den optional i det hele tatt?

Copy link
Member

Choose a reason for hiding this comment

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

Det er noe som ikke stemmer med dette endepunktet

toast.error(t(KEY.common_something_went_wrong));
console.error(error);
});
// eslint-disable-next-line react-hooks/exhaustive-deps
Copy link
Member

Choose a reason for hiding this comment

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

Vi burde egt ikke ignorere disse

permission_classes = [AllowAny]

def get(self, request: Request) -> Response:
venue = self.request.query_params.get('venue', Venue.objects.get(slug='lyche').id)
Copy link
Member

Choose a reason for hiding this comment

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

Disse burde vi samle som konstanter et sted (lyche etc)

def get(self, request: Request) -> Response:
venue = self.request.query_params.get('venue', Venue.objects.get(slug='lyche').id)
biggest_table = Table.objects.filter(venue=venue).order_by('-seating').first()
return Response({'occasion': ReservationOccasion.choices, 'biggest_table': biggest_table.seating if biggest_table else 0}, status=status.HTTP_200_OK)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return Response({'occasion': ReservationOccasion.choices, 'biggest_table': biggest_table.seating if biggest_table else 0}, status=status.HTTP_200_OK)
biggest_seating = getattr(biggest_table, 'seating', 0)
return Response({'occasion': ReservationOccasion.choices, 'biggest_table': biggest_seating}, status=status.HTTP_200_OK)

@robines robines added the stale Inactive issue or pull request label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Inactive issue or pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants