Service orders are the operational core of SCO Autolavados. Every vehicle that enters the car wash generates a service order that progresses through a state lifecycle — from the moment it joins the queue at reception, through the active wash, to final completion. TheDocumentation 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.
state field is a free string, but the four canonical values used by the system are EN_ESPERA (manually queued by admin), PENDIENTE (auto-queued from a confirmed reservation), LAVANDO (wash in progress), and FINALIZADO (complete). The service order record ties together the vehicle, the customer, the assigned laundrer, and the service performed, creating a traceable audit trail used for productivity tracking, payroll calculation, and sales invoicing.
Order Lifecycle
EN_ESPERA — Vehicle Enters the Queue
The receptionist (Admin) creates the order when the vehicle arrives. The order is assigned a All fields except
state of EN_ESPERA and appears on the operations board visible to staff.comment are required. timeStart and stimatedTimeEnd are ISO 8601 timestamps. The estimated end time is derived from the service’s stimatedTimeMin value set in the service catalogue.LAVANDO — Wash in Progress
When the vehicle moves into the wash bay, an Admin assigns a laundrer and transitions the order to Side effect: If the assigned laundrer does not already have
LAVANDO via the start endpoint. The system validates that the selected laundrer is not already actively washing another vehicle before accepting the assignment.isWorkingToday = true, the system automatically sets it and records lastShiftStart with the current timestamp. This ensures the laundrer is counted in the payroll pool for the day.FINALIZADO — Wash Complete
Once the wash is finished, an Admin marks the order as complete. Side effect: If the service has
timeEnd is automatically set to the current server timestamp, enabling per-laundrer productivity reporting.ServiceResource entries (linked inventory items), the corresponding quantities are automatically decremented from stock when the order reaches FINALIZADO.Only users with the Admin role can create or transition service orders. Customers cannot directly interact with the service order queue.
Estimated Wait Time Algorithm
The public wait-time endpoint provides real-time queue data used by the customer-facing display and web app.EN_ESPERA) orders by the number of laundrers currently active on shift:
Laundrer Shift Management
A laundrer must have an active shift before being assigned to a service order. Shifts are managed independently from order assignment.isWorkingToday flag on the User record determines whether a laundrer:
- Is counted as available in the wait-time calculation
- Appears in the payroll pool at end-of-day
isWorkingToday to false for all laundrers automatically, clearing the shift state for the new day.
When an Admin uses
PATCH /api/service-orders/:id/start to assign a laundrer, the system will automatically activate their shift (isWorkingToday = true) if it wasn’t already set. This allows fast assignment even if the Admin forgot to start the shift manually.Admin Actions Summary
| Method | Path | Auth | Description |
|---|---|---|---|
POST | /api/service-orders | Admin | Create new order and add to queue |
PATCH | /api/service-orders/:id/start | Admin | Assign laundrer, transition to LAVANDO |
PATCH | /api/service-orders/:id/finish | Admin | Complete order, record timeEnd |
PATCH | /api/service-orders/:id/state | Admin | Set an arbitrary state string on an order |
DELETE | /api/service-orders/:id | Admin | Permanently delete a service order record |
PATCH | /api/laundrers/:id/shift/start | Admin | Clock laundrer in for the day |
PATCH | /api/laundrers/:id/shift/end | Admin | Clock laundrer out |
GET | /api/service-orders | Admin | List all orders with filters |
GET | /api/autolavado/waiting-time | Public | Real-time queue wait estimate |
Service Orders API Reference
Full endpoint reference for service order creation, state transitions, and queue management including request/response schemas.