Teams and players are global records — they exist independently of any season. Enrolling a team in a season creates aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Danielsl4/TFG_DAM_2526_Consulta/llms.txt
Use this file to discover all available pages before exploring further.
team_stats record for that season. Enrolling a player in a season and team creates a team_players record. This separation means the same team and player profiles carry across multiple seasons without duplication.
Teams
Team fields
| Field | Description |
|---|---|
name | Display name of the team. Required. |
kit_color | Primary kit colour, stored as a string (for example #e74c3c). |
logo_url | Cloudinary URL of the team’s badge. Upload via POST /admin/upload?folder=teams. |
delegate | Name of the team delegate or club representative. |
coach | Name of the head coach. |
phone | Contact phone number for the team. |
is_active | Whether the team is active. Soft-deleted teams set this to false. |
Creating a team
Send aPOST request to /teams with the fields above. Only name is required. If you include a season_id in the request body, the team is immediately enrolled in that season (a team_stats record is created with all statistics at zero).
Enrolling an existing team in a season
To enroll a team that already exists into a new season without recreating it:team_stats record for the team in the given season. If a record already exists it is replaced to avoid duplicates.
Editing a team
Send aPUT request to /teams/:id with the fields you want to update. If you change logo_url to a different Cloudinary asset, the old image is automatically deleted from Cloudinary — as long as the Cloudinary public ID has changed. If you upload a replacement image to the same path (same public ID), Cloudinary has already overwritten it and no deletion is needed.
Removing a team from a season
To remove a team from one specific season without affecting other seasons:team_stats record for that season and unlinks all its players from the team within that season (the players remain enrolled in the season, just without a team assignment).
Soft delete and trash
Deleting a team globally (DELETE /teams/:id) sets is_active = false — it does not remove the record from the database. Soft-deleted teams are excluded from all public listings and season-filtered queries. You can view them in the trash (GET /teams/admin/trash) and restore them at any time (POST /teams/:id/restore).
Permanent deletion of teams has been disabled to preserve match history and
Cloudinary assets. Use soft delete and restore to manage team visibility.
Players
Player fields
| Field | Description |
|---|---|
name | Full name of the player. Required. |
birth_date | Date of birth in ISO format (YYYY-MM-DD). |
photo_url | Cloudinary URL of the player’s photo. Upload via POST /admin/upload?folder=players. |
is_active | Whether the player is active. Soft-deleted players set this to false. |
Creating a player
Send aPOST request to /players with the fields above. Only name is required. If you include season_id and optionally team_id, the player is immediately enrolled in the given season and team.
Enrolling an existing player in a season
To register an existing player in a new season, or to transfer them to a different team within the same season:Removing a player
You have three levels of removal:| Action | Endpoint | Effect |
|---|---|---|
| Remove from one team in a season | DELETE /players/:id/unregister (body: team_id, season_id) | Deletes the specific team_players row |
| Remove from an entire season | DELETE /players/:id/season/:seasonId | Deletes all team_players rows for that season and removes season statistics |
| Soft delete globally | DELETE /players/:id | Sets is_active = false; player excluded from all listings |
POST /players/:id/restore.
Permanent deletion of players has been disabled to preserve match history and
Cloudinary assets.
Roster assignment per season
Theteam_players table links players to teams within a specific season. Each row stores:
| Column | Description |
|---|---|
player_id | Reference to the player |
team_id | Reference to the team |
season_id | Reference to the season |
jersey_number | Shirt number for this season (stored as a string to allow non-numeric values) |
Carrying rosters between seasons
When you create a new season withimport_from, or run POST /seasons/:id/import-structure, the platform copies every team_players row from the source season into the new season. Players retain their team assignments and jersey numbers. You can then adjust rosters manually before the new season begins — adding new signings, changing numbers, or removing players who have left.
Uploading logos and photos
Use the shared image upload endpoint for both team logos and player photos:multipart/form-data request with a single field named image. The server processes the image with Sharp (resizing and compressing it) before uploading to Cloudinary, and returns the resulting URL:
logo_url field or the player’s photo_url field when creating or updating the record. All upload requests require an admin JWT.