Skip to main content

Documentation 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.

All endpoints on this page require a valid JWT and the admin role. Requests that are unauthenticated or belong to a non-admin account receive 401 or 403 respectively.

GET /admin/summary

Returns headline counts for the admin dashboard and the five most recent audit log entries. Results can be scoped to a specific season.
season_id
number
When provided, totalTeams, totalPlayers, and pendingMatches are filtered to that season. totalUsers is always global. Audit logs are filtered to entries whose details reference the same season (entries with no season reference are included regardless).
cURL
curl "http://localhost:3000/admin/summary?season_id=3" \
  -H "Authorization: Bearer <token>"

Response fields

stats
object
recentActivity
object[]
Five most recent audit log entries.

GET /admin/active-season

Returns the currently active season. Useful for initialising admin views that must always operate in the context of the live season.
cURL
curl http://localhost:3000/admin/active-season \
  -H "Authorization: Bearer <token>"
Returns 404 when no season has is_active = true.

POST /admin/upload

Uploads an image to Cloudinary. The server processes the file with Sharp before uploading. Send the image as a multipart/form-data request using the field name image.
folder
string
default:"general"
Cloudinary folder to upload the image into (e.g. teams, players).
filename
string
Custom public ID to use in Cloudinary. When omitted, a generated ID is used.
The request body must be multipart/form-data containing a field named image with the binary file data.
cURL
curl -X POST "http://localhost:3000/admin/upload?folder=teams&filename=rayo_vallecas_logo" \
  -H "Authorization: Bearer <token>" \
  -F "image=@/path/to/logo.png"
url
string
Public Cloudinary URL of the uploaded image.
The server converts images to WebP format via Sharp before uploading. The original file format does not affect the output URL extension.

GET /admin/users

Returns a paginated, searchable list of active user accounts.
Case-insensitive, accent-insensitive filter applied to both username and email.
page
number
default:"1"
Page number.
limit
number
default:"10"
Results per page.
cURL
curl "http://localhost:3000/admin/users?search=ana&page=1&limit=10" \
  -H "Authorization: Bearer <token>"
users
object[]
total
number
Total matching active accounts.
page
number
Current page.
limit
number
Results per page.

PUT /admin/users/:id

Changes the role of a user account.
id
number
required
User identifier.
role
string
required
New role. One of user, referee, or admin.
cURL
curl -X PUT http://localhost:3000/admin/users/101 \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"role": "referee"}'
message
string
Confirmation message.
user
object

DELETE /admin/users/:id

Deactivates a user account and anonymises its username and email by appending a deletion timestamp. The account is set to is_active = false and cannot be recovered through the API.
id
number
required
User identifier.
cURL
curl -X DELETE http://localhost:3000/admin/users/101 \
  -H "Authorization: Bearer <token>"
This action anonymises the user’s personal data. It cannot be undone through the API.

GET /admin/logs

Returns paginated audit logs with optional filters. Logs record every significant admin or referee action in the system.
page
number
default:"1"
Page number.
limit
number
default:"20"
Results per page.
season_id
number
Filter to logs referencing this season (entries with no season in their details are still included).
username
string
Filter by actor username (accent-insensitive partial match).
date
string
Filter to logs created on a specific date (ISO 8601 date, e.g. 2025-03-15).
cURL
curl "http://localhost:3000/admin/logs?season_id=3&page=1&limit=20" \
  -H "Authorization: Bearer <token>"
logs
object[]
total
number
Total matching log entries.
page
number
Current page.
limit
number
Results per page.

Build docs developers (and LLMs) love