FutsalLeague Manager gives referees and administrators complete control over every match, from the moment it is scheduled through to final whistle. Each fixture moves through a well-defined lifecycle, supports granular live event recording, and triggers automatic updates to standings and player statistics the instant it is finalized — all within a single atomic database transaction.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.
Match lifecycle
Every match carries astatus field that controls what actions are available on it.
| Status | Meaning |
|---|---|
pendiente | Scheduled, not yet started. Fans can vote on the outcome. |
en_curso | In progress. The referee is actively recording events. Voting is closed. |
finalizado | Full time. Standings and player stats have been updated. Votes are settled. |
finalizado returns an error.
Match phases
Thephase field places a match in the correct stage of the competition bracket.
| Phase | Display name |
|---|---|
fase_de_grupos | Group stage |
octavos | Round of 16 |
cuartos | Quarter-finals |
semis | Semi-finals |
final | Final |
fase_de_grupos) display a penalty-shootout option when the two sides are level at full time.
Live event recording
While a match isen_curso, referees record events one at a time. Each event is attached to a specific player and team side (home or away).
| Event type | Effect |
|---|---|
gol | Increments home_goals or away_goals and adds 1 to the player’s season goal tally. |
tarjeta_amarilla | Adds 1 yellow card to the player’s and team’s season stats. |
tarjeta_roja | Adds 1 red card to the player’s and team’s season stats. |
penalti_tanda_marcado | Increments home_penalty_goals or away_penalty_goals. Not counted in regular stats. |
penalti_tanda_fallado | Recorded for the shootout log. No score or stat change. |
Match locking system
Before a referee can edit a match, they must acquire an exclusive lock on it. This prevents two officials from accidentally making conflicting changes at the same time.A lock belongs to a single user and auto-expires after 2 minutes of inactivity. The frontend renews it automatically with a heartbeat every 60 seconds while an edit session is open.
POST /matches/:id/lock— Acquire or renew the lock. Returns409 Conflictif another user holds a valid lock.POST /matches/:id/unlock— Release the lock. Admins can force-release any lock with?force=true.- If the referee closes the browser tab, the frontend sends a
navigator.sendBeaconrequest to unlock the match immediately.
Referee workflow
Acquire the lock
Call
POST /matches/:id/lock. If successful, the referee now holds exclusive edit rights on the match. A heartbeat keeps the lock alive every minute.Set the status to en_curso
Call
PUT /matches/:id/status with { "status": "en_curso" }. This signals to fans that the match has kicked off and disables further voting.Record events
For each goal, card, or penalty, call
POST /matches/:id/events with the event type, playerId, and teamSide. Events update the scoreline and individual/team stats immediately.Finalization transaction
When a match is finalized, the following all happen atomically:- Match
statusis set tofinalizadoand the lock is cleared. player_stats.matches_playedis incremented for every player who appeared in a match event.team_statsis upserted with points (3 for a win, 1 for a draw, 0 for a loss), goal counts, and win/draw/loss tallies.- Fan votes that matched the actual result have
points_awarded = 1set and the correspondinguser_pointsrow is incremented.
Voting stats
Every match response includes avotingStats object regardless of status, so the UI can display community sentiment on both pending and finished fixtures.
Match object
The following is a representative JSON response fromGET /matches/:id.
Event types in API responses are translated from Spanish database values to English:
gol → goal, tarjeta_amarilla → yellow_card, tarjeta_roja → red_card, penalti_tanda_marcado → penalty_shootout_goal, penalti_tanda_fallado → penalty_shootout_miss.