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 Dashboard KPIs endpoint aggregates the most important operational and financial metrics into a single response for the administrative panel. All date calculations are anchored to Venezuela Time (VET, UTC-4) via dayjs with the America/Caracas timezone, so “today” always reflects the local business day.
Combine GET /api/dashboard/kpis with GET /api/payroll/daily for a complete end-of-day administrative summary: the KPI endpoint covers revenue, vehicle counts, and laundrer utilization, while the payroll endpoint shows the commission pool breakdown and per-laundrer payout.

Endpoints

GET /api/dashboard/kpis

Return real-time business KPIs for the admin dashboard. All “today” metrics are computed against the current date in VET (UTC-4) at the time of the request. The weekly sales history covers the current day plus the 6 preceding calendar days. Authentication: Requires a valid JWT token with the ADMIN role.
curl http://localhost:3000/api/dashboard/kpis \
  -H "Authorization: Bearer <ADMIN_TOKEN>"
Response 200 — KPI object:
{
  "balanceUsd": 150.0,
  "balanceBs": 93331.5,
  "todayIncomeUsd": 37.5,
  "vehiclesAttendedToday": 8,
  "activeLaundrersToday": 3,
  "totalLaundrers": 5,
  "weeklySales": [
    { "date": "20/06", "incomeUsd": 42.0 },
    { "date": "21/06", "incomeUsd": 28.5 },
    { "date": "22/06", "incomeUsd": 0.0 },
    { "date": "23/06", "incomeUsd": 15.0 },
    { "date": "24/06", "incomeUsd": 60.0 },
    { "date": "25/06", "incomeUsd": 33.0 },
    { "date": "26/06", "incomeUsd": 37.5 }
  ]
}
Error responses:
StatusCondition
500Internal calculation error
401Missing or invalid JWT token
403Caller does not have the ADMIN role

KPI Response Field Reference

FieldTypeDescription
balanceUsdnumberCurrent USD cash balance from the AutoLavado record. Increases with approved payments, decreases with registered expenses.
balanceBsnumberCurrent Bolívares balance from the AutoLavado record. Updated in the same way as balanceUsd.
todayIncomeUsdnumberSum of totalUsd across all Sales records created today (VET). Represents finalized, invoiced revenue for the day.
vehiclesAttendedTodaynumberCount of ServiceOrders with state = "FINALIZADO" whose timeEnd falls within today (VET). Reflects actual washes completed, not just orders created.
activeLaundrersTodaynumberCount of users with the LAUNDRER role whose isWorkingToday flag is currently true. Reflects the live number of laundrers on shift.
totalLaundrersnumberTotal count of users with the LAUNDRER role regardless of shift status. Useful for capacity planning context.
weeklySalesarray7-element array of daily revenue totals for the last 7 days (oldest → newest). Each element has date (formatted DD/MM) and incomeUsd (total USD invoiced that day).

weeklySales Array

The weeklySales array is built by iterating from 6 days ago through today, querying the Sales table for each day’s total. Days with no sales return incomeUsd: 0.0. This array is suitable for rendering a bar or line chart on the admin panel without any client-side aggregation.
"weeklySales": [
  { "date": "20/06", "incomeUsd": 42.0 },
  { "date": "21/06", "incomeUsd": 28.5 },
  { "date": "22/06", "incomeUsd": 0.0 },
  { "date": "23/06", "incomeUsd": 15.0 },
  { "date": "24/06", "incomeUsd": 60.0 },
  { "date": "25/06", "incomeUsd": 33.0 },
  { "date": "26/06", "incomeUsd": 37.5 }
]
The exact response shape is determined by the getDashboardKpis controller implementation in src/controllers/Dashboard.ts. The fields documented above reflect the current implementation. If the controller is extended in the future (e.g. to add top customers, expense summaries, or inventory alerts), new fields will appear in the response. Recommend reading the live endpoint response to discover any additions beyond what is documented here.

Use these endpoints alongside the dashboard for a full administrative view:

Payroll — Daily Pool

Calculate the laundrer commission pool and per-laundrer payout for any date. Combine with KPIs for end-of-day reporting.

AutoLavado — Exchange Rate

Fetch the current BCV USD/EUR → Bolívares rate used to convert balances and sale totals.

Sales — Invoice History

Full invoice history with line-item details. The source for todayIncomeUsd and weeklySales data.

AutoLavado — Wait Time

Real-time estimated wait time based on active laundrers and queued orders.

Build docs developers (and LLMs) love