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) viaDocumentation 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.
dayjs with the America/Caracas timezone, so “today” always reflects the local business day.
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.| Status | Condition |
|---|---|
500 | Internal calculation error |
401 | Missing or invalid JWT token |
403 | Caller does not have the ADMIN role |
KPI Response Field Reference
| Field | Type | Description |
|---|---|---|
balanceUsd | number | Current USD cash balance from the AutoLavado record. Increases with approved payments, decreases with registered expenses. |
balanceBs | number | Current Bolívares balance from the AutoLavado record. Updated in the same way as balanceUsd. |
todayIncomeUsd | number | Sum of totalUsd across all Sales records created today (VET). Represents finalized, invoiced revenue for the day. |
vehiclesAttendedToday | number | Count of ServiceOrders with state = "FINALIZADO" whose timeEnd falls within today (VET). Reflects actual washes completed, not just orders created. |
activeLaundrersToday | number | Count of users with the LAUNDRER role whose isWorkingToday flag is currently true. Reflects the live number of laundrers on shift. |
totalLaundrers | number | Total count of users with the LAUNDRER role regardless of shift status. Useful for capacity planning context. |
weeklySales | array | 7-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
TheweeklySales 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.
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.Related Endpoints
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.