Kizspy.me
。 Validate if bookingld does not exist, then return message: "Booking not found"
Question 4 (2.5 points) - Create a New Booking
Task: Develop an API that allows a user to book tickets for an event.
API Details:
• Method: POST
• URI:
http://localhost:9999/api/bookings
• Input:
}
}
"userid": "..."
"eventId": "..."
"quantity":...
802 Summer 2025
Zoom
Output: The newly created booki document.
о
Validate:
■ If eventid does not exist, return message: "Event not found"
■ If the number of tickets to book (quantity) is greater than available Tickets
returns the message: "Not enough tickets available"
Additional Requirement: Automatically update the availableTickets field of the
event (decrease based on quantity booked).
+ 100%
Close