These endpoints control the full lifecycle of a match — from creation through live event recording to finalisation. They are protected by role-based middleware and, for referee operations, require an active edit lock on the match. The table below lists all endpoints at a glance. Detailed descriptions follow in the sections beneath.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/danielsl4/TFG_DAM_2526/llms.txt
Use this file to discover all available pages before exploring further.
| Method | Path | Role required | Lock required |
|---|---|---|---|
POST | /matches | admin | — |
DELETE | /matches/:id | admin | — |
PUT | /matches/:id/teams | admin | — |
POST | /matches/:id/lock | referee | — |
POST | /matches/:id/unlock | referee | — |
PUT | /matches/:id/status | referee | yes |
PUT | /matches/:id/observations | referee | yes |
POST | /matches/:id/events | referee | yes |
DELETE | /matches/:matchId/events/:eventId | referee | yes |
PUT | /matches/:id/finish | referee | yes |
POST | /matches/:id/vote | user | — |
Authorization: Bearer <token> header.Admin endpoints
POST /matches — create a match
POST /matches — create a match
"pendiente".Auth: adminBody parameters
"fase_de_grupos"."Winner Group A").201: { "message": "Partido creado correctamente", "id": <number> }DELETE /matches/:id — delete a match
DELETE /matches/:id — delete a match
adminPath param: id (number, required) — match to delete.Response 200: { "message": "Partido eliminado correctamente" }Response
404: Match not found.PUT /matches/:id/teams — update team assignments
PUT /matches/:id/teams — update team assignments
null to clear a slot.Auth: adminPath param: id (number, required)Body parameters
200: { "message": "Equipos actualizados correctamente", "success": true }Response
404: Match not found.Referee endpoints
Referee operations require both thereferee (or admin) role and, where indicated, an active edit lock acquired via POST /matches/:id/lock.
POST /matches/:id/lock — acquire edit lock
POST /matches/:id/lock — acquire edit lock
refereePath param: id (number, required)Response 200: { "message": "Bloqueo obtenido/renovado", "success": true }Response
409: Another user holds the lock. Response includes owner (username).POST /matches/:id/unlock — release edit lock
POST /matches/:id/unlock — release edit lock
admin role or pass ?force=true.Auth: refereePath param: id (number, required)Query param:
force (boolean) — admin-only override to release any lock.Response 200: { "message": "Partido desbloqueado correctamente" }Response
403: Caller does not own the lock and force is not set.PUT /matches/:id/status — set match status
PUT /matches/:id/status — set match status
referee + lockPath param: id (number, required)Body parameters
"pendiente", "en_curso", or "finalizado".200: { "message": "Estado actualizado a <status>" }Response
400: Invalid status value.PUT /matches/:id/observations — set observations
PUT /matches/:id/observations — set observations
null or an empty string to clear.Auth: referee + lockPath param: id (number, required)Body parameters
null to clear existing observations.200: { "message": "Observaciones actualizadas correctamente" }POST /matches/:id/events — add an event
POST /matches/:id/events — add an event
referee + lockPath param: id (number, required)Body parameters
"gol", "tarjeta_amarilla", "tarjeta_roja", "penalti_tanda_marcado", "penalti_tanda_fallado"."home" or "away". Used to update the correct score column.200: { "message": "Evento registrado correctamente" }Response
400: Invalid type, missing playerId, or missing teamSide.DELETE /matches/:matchId/events/:eventId — remove an event
DELETE /matches/:matchId/events/:eventId — remove an event
referee + lockPath params:200: { "message": "Evento eliminado correctamente" }Response
500: Event not found or transaction failure.PUT /matches/:id/finish — finalise a match
PUT /matches/:id/finish — finalise a match
"finalizado", calculates and persists team standings (points, wins, draws, losses, goals), increments matches_played for participating players, evaluates prediction votes, and awards points to users who predicted the correct result. The edit lock is released as part of this operation.Auth: referee + lockPath param: id (number, required)Body parameters
200: { "message": "Partido finalizado, clasificación y porra actualizadas" }Response
500: Match already finalised, or transaction error.User endpoints
POST /matches/:id/vote — submit a prediction vote
POST /matches/:id/vote — submit a prediction vote
"pendiente" where both teams are assigned. Calling this endpoint again with a different value replaces the previous vote (upsert).Auth: user (any authenticated role)Path param: id (number, required)Body parameters
"local" (home win), "empate" (draw), or "visitante" (away win).200:400: Invalid vote value, match already started/finished, or teams not yet assigned.Response
404: Match not found.