Skip to main content

Documentation 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.

The AutoLavado resource represents the single business configuration record for the car wash. It stores company identity, current financial balances, the cached BCV exchange rates, commission settings for the payroll system, and the payroll period.
Singleton record: There is exactly one AutoLavado row in the database. It is auto-created during server startup by the initializeApp() bootstrap function — you never need to POST to create it. All writes go through the PUT /api/autolavado update endpoint.

Endpoints

GET /api/autolavado

Retrieve the current business configuration and financial balances. Authentication: Public — no token required.
curl http://localhost:3000/api/autolavado
Response 200 — AutoLavado object:
{
  "id": "al1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "name": "Multiservicios La Miami",
  "address": "Barinas, Venezuela",
  "phone": "0273-0000000",
  "email": null,
  "photo": null,
  "rif": "J-00000000-0",
  "balanceUsd": 150.0,
  "balanceBs": 5000.0,
  "currentTasaBs": 622.21,
  "currentTasaEurBs": 680.50,
  "lastTasaUpdate": "2026-06-26T06:00:00.000Z",
  "commissionPercent": 40,
  "commissionType": "BASE_SERVICE",
  "payrollPeriod": "DAILY"
}
Error responses:
StatusCondition
404AutoLavado record not found (misconfigured server)
500Internal server error

PUT /api/autolavado

Update the business configuration. Only the fields you include are updated — all others remain unchanged. Financial balance fields (balanceUsd, balanceBs) and tasa fields are managed automatically by the payments and exchange-rate systems and should not be overwritten here. Authentication: Requires a valid JWT token with the ADMIN role.

Request Body (all fields optional)

name
string
Business display name, e.g. "Multiservicios La Miami".
address
string
Physical address of the car wash.
phone
string
Contact phone number.
email
string
Contact email address. Must be unique in the database.
rif
string
Venezuelan tax ID (RIF). Must be unique. Format: J-00000000-0.
photo
string
URL to the business logo or photo.
commissionPercent
number
Percentage of each finished service order’s price that goes to the laundrer commission pool. Default is 40. Accepts values between 0 and 100.
commissionType
string
Determines the price basis for commission calculation. Accepted values:
  • "FULL_PRICE" — uses the actual service price
  • "BASE_SERVICE" — uses the base service price for the vehicle’s type
payrollPeriod
string
Payroll reporting period. Accepted values: "DAILY" or "WEEKLY".
curl -X PUT http://localhost:3000/api/autolavado \
  -H "Authorization: Bearer <ADMIN_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{
    "commissionPercent": 35,
    "commissionType": "FULL_PRICE",
    "phone": "0273-1234567"
  }'
Response 200 — Updated AutoLavado object (full object, same shape as GET). Error responses:
StatusCondition
500AutoLavado record not found
401Missing or invalid JWT token
403Caller does not have the ADMIN role

GET /api/autolavado/exchange-rate

Fetch the current USD → Bolívares and EUR → Bolívares exchange rates from the BCV (Banco Central de Venezuela) via dolarapi.com. The rate is cached in the AutoLavado record and refreshed automatically whenever the cached date is different from today, or if either cached value is 0. Authentication: Public — no token required.
curl http://localhost:3000/api/autolavado/exchange-rate
Response 200:
{
  "tasaBs": 622.21,
  "tasaEurBs": 680.50,
  "lastUpdate": "2026-06-26T06:00:00.000Z"
}
The exchange rate is fetched from https://ve.dolarapi.com/v1/dolares/oficial (USD) and https://ve.dolarapi.com/v1/euros/oficial (EUR). The promedio field is preferred; venta and price are used as fallbacks. If the external API is unreachable, the cached value from the previous successful fetch is returned.
Response fields:
FieldTypeDescription
tasaBsnumberCurrent USD → Bolívares official rate
tasaEurBsnumberCurrent EUR → Bolívares official rate
lastUpdatestringISO 8601 timestamp of the most recent successful rate fetch
Error responses:
StatusCondition
404AutoLavado not configured in the database
500Internal server error

GET /api/autolavado/waiting-time

Calculate the estimated customer wait time based on orders currently in the EN_ESPERA (waiting) queue and the number of laundrers currently on shift. The formula is: estimatedWaitTimeMin = round(totalStimatedTime / max(1, activeLaundrers)), where totalStimatedTime is the sum of stimatedTimeMin across all queued orders. Division by zero is avoided by flooring active laundrers to 1. Authentication: Public — no token required.
curl http://localhost:3000/api/autolavado/waiting-time
Response 200:
{
  "estimatedWaitTimeMin": 45,
  "totalStimatedTime": 90,
  "activeLaundrers": 2,
  "waitingOrdersCount": 3
}
Response fields:
FieldTypeDescription
estimatedWaitTimeMinnumberEstimated minutes a new customer would wait before their wash begins
totalStimatedTimenumberSum of stimatedTimeMin across all queued (EN_ESPERA) orders created today
activeLaundrersnumberLaundrers currently marked isWorkingToday = true with the Laundrer role
waitingOrdersCountnumberNumber of service orders currently in EN_ESPERA state today
Error responses:
StatusCondition
500Internal server error

AutoLavado Object Reference

FieldTypeDescription
idstringUUID of the singleton AutoLavado record
namestringBusiness name
addressstringPhysical address
phonestringContact phone
emailstring | nullContact email (unique)
photostring | nullURL to business logo
rifstringVenezuelan tax ID (unique)
balanceUsdnumberCurrent cash balance in USD
balanceBsnumberCurrent cash balance in Bolívares
currentTasaBsnumberCached USD → Bs exchange rate
currentTasaEurBsnumberCached EUR → Bs exchange rate
lastTasaUpdatestringISO 8601 timestamp of last rate update
commissionPercentnumberCommission percentage for laundrer pool (default: 40)
commissionTypestring"FULL_PRICE" or "BASE_SERVICE"
payrollPeriodstring"DAILY" or "WEEKLY"

Build docs developers (and LLMs) love