Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Blackterz2/Proyecto_5to_Semestre/llms.txt

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

The Statistics API surfaces the authenticated user’s personal records (PRs) — the maximum weight ever lifted for every exercise they have trained. PR data is aggregated directly in SQL across all completed sets (completada = 1) and returned ordered by peso_maximo DESC. This endpoint powers the progress charts on the Blackterz frontend dashboard.

GET /api/estadisticas/prs

Returns the personal record — the maximum weight ever lifted — for every exercise the authenticated user has logged at least one completed set on. Only sets where sesion_series.completada = 1 are considered. Results are ordered by peso_maximo DESC. Auth required: Yes — Authorization: Bearer <token> The query joins four tables: sesiones_entrenamientosesion_ejerciciossesion_seriesejercicios. It groups by exercise and aggregates with MAX(peso).
Poll this endpoint after every completed workout session to keep the frontend progress charts up to date.

Request

No query parameters or request body. The usuario_id is extracted directly from the JWT by the verificarToken middleware.
curl -X GET https://api.blackterzgym.com/api/estadisticas/prs \
  -H "Authorization: Bearer <your_token>"

Response

status
string
required
"ok" on success.
data
array
required
Array of personal record objects. One entry per exercise where the user has at least one completed set. Empty array [] if the user has no workout history.

Sample response

{
  "status": "ok",
  "data": [
    {
      "ejercicio_id": 3,
      "ejercicio_nombre": "Peso muerto",
      "peso_maximo": 120,
      "reps_maximas": 5,
      "veces_entrenado": 8,
      "total_series_completadas": 24
    },
    {
      "ejercicio_id": 1,
      "ejercicio_nombre": "Press de banca",
      "peso_maximo": 100,
      "reps_maximas": 8,
      "veces_entrenado": 12,
      "total_series_completadas": 36
    },
    {
      "ejercicio_id": 2,
      "ejercicio_nombre": "Sentadilla",
      "peso_maximo": 95,
      "reps_maximas": 6,
      "veces_entrenado": 10,
      "total_series_completadas": 30
    }
  ]
}

Error responses

Returned when the SQL query fails.
{
  "status": "error",
  "message": "Error al obtener los récords personales"
}
Returned when no token or an invalid/expired token is supplied. Raised by the verificarToken middleware before the controller runs.
{
  "status": "error",
  "message": "Token no válido o expirado"
}

Full curl example

curl -X GET https://api.blackterzgym.com/api/estadisticas/prs \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

GET /api/health

Verifies that the API server is running and that the MySQL database connection is healthy. Executes a lightweight SELECT 1 query against the pool. No authentication required. Auth required: None

Response

status
string
"ok"
db
string
"conectada" — the SELECT 1 completed successfully.
{
  "status": "ok",
  "db": "conectada"
}

Curl example

curl -X GET https://api.blackterzgym.com/api/health

Build docs developers (and LLMs) love