The reservations module lets customers and admins schedule car wash appointments in advance, reducing walk-in wait times and helping the business plan staffing. A key feature of the system is its auto-queue pipeline: a cron job periodically inspects confirmed reservations and, when an appointment is within one hour of its scheduled time, automatically creates aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Luisangelebp/SCO_Autolavados/llms.txt
Use this file to discover all available pages before exploring further.
ServiceOrders entry so the vehicle appears in the queue without any manual intervention.
Reservation Status Flow
Reservations progress through four states. The allowed transitions depend on the actor’s role.| State | Description |
|---|---|
PENDING | Initial state when a Customer creates a reservation. Awaits admin review. |
CONFIRMED | Admin has confirmed the appointment. Eligible for auto-queue processing. Reservations created directly by an Admin start in this state. |
COMPLETED | Set automatically by the cron job after the reservation has been converted into a service order. Prevents duplicate processing. |
CANCELLED | The reservation has been cancelled. Records are never physically deleted — they remain for historical integrity. |
Customers can only set a reservation’s status to
CANCELLED. Admins can set any status (PENDING, CONFIRMED, COMPLETED, or CANCELLED) and can modify any reservation in the system.Creating a Reservation
Both Customers and Admins can create reservations. When a Customer creates one, the system validates that the specified vehicle belongs to their account before proceeding.Reservation object with status: "PENDING" (Customer) or status: "CONFIRMED" (Admin).
The system enforces a maximum of 2 active reservations per time slot. Attempting to book a third reservation for the exact same date and time will return an error: "Este turno ya alcanzó su capacidad máxima (2 reservas)".
Viewing Reservations
- Admin: Returns all reservations across all customers, ordered by date ascending.
- Customer: Returns only the reservations belonging to the authenticated user.
?date=YYYY-MM-DD is provided, the response is filtered to reservations scheduled on that calendar day. Without it, all historical reservations are returned.
Each reservation in the response includes the nested car and service objects for display purposes.
Auto-Queue Pipeline
The cron job bridges the gap between the reservations calendar and the live operations queue. It runs every 30 minutes between 6:30 AM and 12:00 PM (VET, UTC-4).Find Eligible Reservations
The job queries all reservations with
status: CONFIRMED whose scheduled date falls within the next 60 minutes from the current time.Create a Service Order
For each eligible reservation, a new
ServiceOrders record is created with:state: "PENDIENTE"timeStart: the reservation’s scheduled date/timestimatedTimeEnd: calculated by adding the service’sstimatedTimeMintotimeStartcarId,serviceId, anduserIdcarried over from the reservation
The auto-queue window (6:30 AM–12:00 PM VET) reflects the typical operating hours of the car wash. Reservations scheduled outside this window will not be auto-queued and must be manually processed by an Admin if needed.
Updating a Reservation
Admins and Customers can both update reservations viaPUT /api/reservations/:id. Customers are limited to modifying their own reservations.
date, carId, serviceId, and status may be included. When changing the date, the slot-capacity check (maximum 2 per timeslot) is re-evaluated automatically.
Soft Delete
DELETE /api/reservations/:id does not physically remove the record from the database. It performs a soft delete by setting status: "CANCELLED", preserving the full appointment history for reporting and audit purposes.
If a Customer attempts to delete a reservation that belongs to another user, the request is rejected with a
403 Forbidden error. Admins can soft-delete any reservation.Reservations API Reference
Full endpoint reference for reservation creation, retrieval, updates, and cancellation including request/response schemas.