POST /api/v1/reservations
Create a new meeting room reservation. The system validates time slots, checks for conflicts, enforces business rules, and syncs with Google Calendar.Authentication
Required: JWT token viaAuthorization: Bearer <token> header
Rate Limiting
- Rate: 30 requests per 2 seconds per IP
- Status Code on Limit: 429 Too Many Requests
Request Body
The ID of the room to reserve. Must be greater than 0.
ISO 8601 timestamp in UTC format. Must be:
- In the future
- Within school hours (6:00 AM - 8:00 PM)
- In UTC timezone
2025-01-28T14:00:00ZISO 8601 timestamp in UTC format. Must be:
- After startTime
- Within school hours (6:00 AM - 8:00 PM)
- In UTC timezone
- Maximum duration:
- Students: 4 hours
- Staff: Unlimited
2025-01-28T16:00:00ZResponse
201 CreatedThe unique identifier for the created reservation
The ID of the reserved room
ISO 8601 timestamp of reservation start time in UTC
ISO 8601 timestamp of reservation end time in UTC
Information about the user who created the reservation
Error Responses
Error message describing what went wrong
Additional details for validation errorsContains field-level error messages for invalid input
Examples
Business Rules
- Future Times Only: Cannot book times in the past
- School Hours: Bookings must be between 6:00 AM - 8:00 PM
- Duration Limits:
- Students: Maximum 4 hours per reservation
- Staff: No duration limit
- Conflict Prevention: System prevents overlapping reservations
- Email Notification: Confirmation email sent automatically
- Calendar Sync: Reservation added to Google Calendar
internal/handler/handler_reservations.go:18
GET /api/v1/reservations
Retrieve unavailable time slots for all rooms within a specified date range. Shows which time slots are booked, with privacy controls based on user role.Authentication
Required: JWT token viaAuthorization: Bearer <token> header
Rate Limiting
- Rate: 30 requests per 2 seconds per IP
- Status Code on Limit: 429 Too Many Requests
Query Parameters
Start date in
YYYY-MM-DD formatExample: 2025-01-28End date in
YYYY-MM-DD formatMaximum range: 60 days from start dateExample: 2025-02-01Response
200 OK - Array of rooms with their reserved slotsThe unique identifier of the room
The name of the room
Array of reserved time slots for this room
Error Responses
Error message describing what went wrong
Additional details for validation errors
Examples
Privacy Rules
Booking details (bookedBy field) are visible to:
- The person who made the booking
- Staff members
bookedBy: null.
Source: internal/handler/handler_reservations.go:73
DELETE /api/v1/reservations/
Cancel an existing reservation. Authorization rules apply based on user role.Authentication
Required: JWT token viaAuthorization: Bearer <token> header
Rate Limiting
- Rate: 30 requests per 2 seconds per IP
- Status Code on Limit: 429 Too Many Requests
Path Parameters
The unique identifier of the reservation to cancel
Response
204 No Content - Reservation successfully cancelled (no response body)Error Responses
Error message describing what went wrong
Examples
Authorization Rules
Users can cancel a reservation if:- They created the reservation themselves, OR
- They have a staff role (staff can cancel any reservation)
Side Effects
- Email Notification: Cancellation notice sent automatically
- Calendar Sync: Event removed from Google Calendar
- Database: Reservation marked as cancelled
internal/handler/handler_reservations.go:110