Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/interezante456-pixel/Miercoles-Proyecto/llms.txt

Use this file to discover all available pages before exploring further.

The Dashboard module exposes a single aggregation endpoint that gives every authenticated user an instant snapshot of store health. The response is computed in real time from live database queries — sales totals, product counts, low-stock alerts, active client count, monthly sales trends, product distribution by category, and pending purchase orders are all returned in one call as nine top-level keys. No date range parameters are required; the service uses LocalDateTime.now() to scope “today” and “this year” queries automatically.

GET /api/dashboard/stats

Returns a map of real-time business KPIs for the current store state. GET http://localhost:8080/api/dashboard/stats

Authorization

Authorization
string
required
Bearer token — accessible by all authenticated roles (ADMIN, VENDEDOR, ALMACENERO).

Response 200 OK

ventasHoy
BigDecimal
Total monetary amount (sum of total) for all sales registered today.
totalVentas
Long
Cumulative count of all sales ever recorded in the system (including voided).
totalProductos
Long
Total number of active products registered in the catalog.
totalClientes
Long
Total number of active clients registered in the system.
comprasPendientes
Integer
Count of purchase orders currently in PENDIENTE state — awaiting stock receipt.
productosStockBajo
array
List of products whose stockActual is at or below their stockMinimo. Each entry contains:
alertasStock
Integer
Numeric count of products with stock below minimum — equivalent to productosStockBajo.length. Useful for badge counters in a UI.
ventasPorMes
object
Monthly sales totals for the current year, keyed by month number (1–12). Months with no sales are included with a value of 0. Useful for rendering bar charts or trend lines.
productosPorCategoria
array
Product count grouped by category. Each entry contains:
Example response — 200 OK
{
  "ventasHoy": 15750.00,
  "totalVentas": 94,
  "totalProductos": 48,
  "totalClientes": 120,
  "comprasPendientes": 2,
  "productosStockBajo": [
    {
      "id": 3,
      "nombre": "Teclado Mecánico RGB",
      "stockActual": 2,
      "stockMinimo": 5
    },
    {
      "id": 7,
      "nombre": "Cable HDMI 2m",
      "stockActual": 4,
      "stockMinimo": 10
    }
  ],
  "alertasStock": 2,
  "ventasPorMes": {
    "1": 45680.00,
    "2": 38200.00,
    "3": 51000.00,
    "4": 0,
    "5": 0,
    "6": 0,
    "7": 0,
    "8": 0,
    "9": 0,
    "10": 0,
    "11": 0,
    "12": 0
  },
  "productosPorCategoria": [
    { "categoria": "Electrónica", "cantidad": 22 },
    { "categoria": "Accesorios", "cantidad": 15 },
    { "categoria": "Periféricos", "cantidad": 11 }
  ]
}
cURL
curl -X GET http://localhost:8080/api/dashboard/stats \
  -H "Authorization: Bearer <token>"

Error Codes

StatusMeaning
401 UnauthorizedToken missing, invalid, or expired.
403 ForbiddenRequest reached the endpoint without a valid authenticated principal.
Poll this endpoint on a short interval (e.g. every 30 seconds) from your frontend to keep KPI cards and charts up to date without requiring a full page reload. The entire response is computed from live queries — there is no caching layer.

Build docs developers (and LLMs) love