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

Solution #720

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

Solution #720

wants to merge 3 commits into from

Conversation

MrEgorLite
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Great job on implementing the core functionalities! 🎉 While there are a few minor areas for improvement, such as ensuring naming consistency and adjusting the pagination settings, these do not critically impact the functionality of your code. Keep up the good work and consider the feedback for future enhancements! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

class OrderPagination(PageNumberPagination):
page_size = 1
page_size_query_param = "page_size"
max_page_size = 1

Choose a reason for hiding this comment

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

The max_page_size is set to 1, which might be too restrictive for practical use cases. Consider increasing this value to allow more flexibility in the number of items per page.

Comment on lines +132 to +136
tickets = TicketSerializer(
many=True,
read_only=False,
allow_empty=False
)

Choose a reason for hiding this comment

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

In the OrderCreateSerializer, the tickets field uses TicketSerializer with read_only=False and allow_empty=False. Ensure that the TicketSerializer is capable of handling the input data correctly, especially if there are any nested relationships or specific validation requirements.

Comment on lines +138 to +144
def create(self, validated_data):
with transaction.atomic():
tickets_data = validated_data.pop("tickets")
order = Order.objects.create(**validated_data)
for ticket_data in tickets_data:
Ticket.objects.create(order=order, **ticket_data)
return order

Choose a reason for hiding this comment

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

The create method in OrderCreateSerializer is correctly using transaction.atomic() to ensure that the order and associated tickets are created atomically. However, consider adding validation to ensure that the tickets_data is not empty before proceeding with the creation of the order.

@@ -6,7 +6,7 @@
ActorViewSet,
CinemaHallViewSet,
MovieViewSet,
MovieSessionViewSet,
MovieSessionViewSet, OrderSessionViewSet,

Choose a reason for hiding this comment

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

The OrderSessionViewSet is registered in the router. Ensure that this is the correct name for the viewset, as it might be intended to be OrderViewSet based on typical naming conventions. Verify the viewset name in the views file to ensure consistency.

return queryset


class OrderSessionViewSet(viewsets.ModelViewSet):

Choose a reason for hiding this comment

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

The class OrderSessionViewSet might be incorrectly named. It is likely intended to be OrderViewSet based on the context of handling orders. Verify the intended name and update it for consistency across the application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants