Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Danielsl4/TFG_DAM_2526_Consulta2/llms.txt

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

Seasons and groups define the competition structure of the league. Each season contains one or more groups, and each group organizes the teams that play within it. Admin endpoints require a valid JWT with the admin role.

Seasons

Seasons are the top-level container for a competition. Each season has a name, optional date range, and an active flag.

Season object

id
number
required
Unique identifier for the season.
name
string
required
Display name for the season (e.g. "Liga Sala 2025").
start_date
string
Season start date in YYYY-MM-DD format.
end_date
string
Season end date in YYYY-MM-DD format.
is_active
boolean
required
Whether this season is currently active. Only one season can be active at a time.

GET /seasons

Returns all seasons ordered by start_date descending. No authentication required.
cURL
curl --request GET \
  --url 'http://localhost:3000/seasons'

POST /seasons

Creates a new season. Requires admin role. Optionally imports groups, team rosters, and player squads from an existing season in the same transaction.
name
string
required
Name of the new season.
start_date
string
Start date in YYYY-MM-DD format.
end_date
string
End date in YYYY-MM-DD format.
is_active
boolean
default:"false"
Set to true to immediately activate this season. All other seasons are deactivated automatically.
import_from
number
Season ID to import groups and player rosters from. The import runs atomically in the same database transaction as the season creation.
cURL
curl --request POST \
  --url 'http://localhost:3000/seasons' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{"name": "Liga Sala 2026", "start_date": "2026-09-01", "end_date": "2027-06-30", "is_active": false}'

PUT /seasons/:id

Updates an existing season. Requires admin role. If is_active is set to true, all other seasons are deactivated first.
id
number
required
ID of the season to update.
name
string
required
Updated season name.
start_date
string
Updated start date in YYYY-MM-DD format.
end_date
string
Updated end date in YYYY-MM-DD format.
is_active
boolean
Set to true to activate this season (deactivates all others).
cURL
curl --request PUT \
  --url 'http://localhost:3000/seasons/3' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{"name": "Liga Sala 2025-26", "start_date": "2025-09-01", "end_date": "2026-06-30", "is_active": true}'

DELETE /seasons/:id

Permanently deletes a season. Requires admin role. Returns 400 if the season has dependent records (groups, matches).
id
number
required
ID of the season to delete.

POST /seasons/:id/import-structure

Clones groups, team stats, and player squads from another season into the season identified by :id. Runs atomically. Requires admin role.
id
number
required
ID of the destination season (the one receiving the imported structure).
fromSeasonId
number
required
ID of the source season to clone the structure from.

Only one season can be active at a time. Setting is_active: true on any season (via POST or PUT) automatically deactivates all other seasons in the same operation.

Groups

Groups organize teams within a season. Each group belongs to exactly one season.

Group object

id
number
required
Unique identifier for the group.
name
string
required
Display name for the group (e.g. "Grupo A").
season_id
number
required
ID of the season this group belongs to.

GET /groups

Returns all groups joined with their season name. Optionally filter by season. No authentication required.
season_id
number
Filter groups to a specific season.
cURL
curl --request GET \
  --url 'http://localhost:3000/groups?season_id=3'

POST /groups

Creates a new group. Requires admin role.
name
string
required
Name for the new group.
season_id
number
required
ID of the season this group belongs to.
cURL
curl --request POST \
  --url 'http://localhost:3000/groups' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{"name": "Grupo A", "season_id": 3}'

PUT /groups/:id

Updates a group’s name or season assignment. Requires admin role.
id
number
required
ID of the group to update.
name
string
required
Updated group name.
season_id
number
required
Updated season ID.
cURL
curl --request PUT \
  --url 'http://localhost:3000/groups/7' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{"name": "Grupo B", "season_id": 3}'

DELETE /groups/:id

Permanently deletes a group. Requires admin role. Returns 400 if the group has associated matches.
id
number
required
ID of the group to delete.

Build docs developers (and LLMs) love