Appointment Booking API · Step 3 of 7
Model the database
Create services and bookings tables with IDs, timestamps, status, and a clear relationship. Decide how to represent a slot and store timestamps consistently in UTC.
Understand
Relational constraints protect core rules even when requests arrive concurrently or code has a bug.
Build
Add foreign keys, required fields, status constraints, and a uniqueness rule or locking strategy that prevents overlapping bookings for the same resource and time.
Check
The schema rejects a booking with no service and has a deliberate mechanism for conflicting requests.
Try it
Explain how you would support multiple staff members without blocking valid simultaneous bookings.
