Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ierinconc/billar-pro-backend/llms.txt

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

Sessions (sesiones) are the permanent billing records that Billar Pro generates whenever a table is closed. You never create a session directly — the system creates one automatically when PUT /api/mesas/{id}/cerrar is called. At that moment the service calculates elapsed time, applies the table’s hourly rate, sums all open consumptions, and writes a single immutable Sesion row. The sessions API therefore provides read-only access to the complete historical ledger of every table session that has ever been closed.

Endpoints

GET /api/sesiones

Returns the full list of completed sessions ordered by database insertion sequence. Authentication: Required — include a valid JWT Bearer token. Query parameters: None. Response: 200 OK — array of Sesion objects.
id
Long
Auto-generated primary key of the session.
mesa
object
The billiard table that was closed to produce this session.
horaInicio
String (ISO 8601 datetime)
Timestamp when the table was opened and the session clock started, e.g. "2025-06-01T14:00:00".
horaFin
String (ISO 8601 datetime)
Timestamp when PUT /api/mesas/{id}/cerrar was called and the session was finalised.
horasJugadas
Double
Elapsed time in fractional hours, computed as Duration.toMinutes() / 60.0.
totalMesa
Double
Table charge: horasJugadas × mesa.precioPorHora.
totalConsumos
Double
Sum of the subtotal of every Consumo linked to this session.
totalGeneral
Double
Grand total: totalMesa + totalConsumos.
fecha
String (ISO 8601 date)
Calendar date on which the session was recorded, e.g. "2025-06-01".

Request example

curl -X GET http://localhost:8080/api/sesiones \
  -H "Authorization: Bearer <token>"

Response example

[
  {
    "id": 12,
    "mesa": {
      "id": 3,
      "numero": 3,
      "estado": "LIBRE",
      "precioPorHora": 8000.0
    },
    "horaInicio": "2025-06-01T14:00:00",
    "horaFin": "2025-06-01T16:30:00",
    "horasJugadas": 2.5,
    "totalMesa": 20000.0,
    "totalConsumos": 7500.0,
    "totalGeneral": 27500.0,
    "fecha": "2025-06-01"
  }
]

Sessions are created exclusively by the table-close workflow (PUT /api/mesas/{id}/cerrar). There are no POST, PUT, or DELETE endpoints on /api/sesiones — the historical record is immutable once written.
For aggregated analytics — daily revenue, busiest tables, average session length — see the /api/reportes endpoints, which build on top of the sessions table.

Build docs developers (and LLMs) love