K
Kizspy.me
。 Validate seats as a non-empty array, where each seat has:
seatNumber: Non-empty string.
■ type: Either adult or child.
■ price: Positive number.
discount: Optional, non-negative number (default to 0 if not
provided).
• Verify the user exists in the users collection.
o Verify the showtime exists in the showtimes collection.
2025
o Check that all requested seatNumbers are available in the showtime's seats
array (status: available).
。 Calculate totalPrice as the sum of (price - discount) for each seat.
o Create a new ticket in the tickets collection with userld, showtimeld,
formatted seats, and totalPrice.
。 Update the showtime's seats array to set the status of requested seats to
booked.
o Return the created ticket in the response.
• Handle errors with appropriate status codes and messages.
ESD
----END---
Zoom
+ 100%
Close