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.

All /admin/* endpoints are restricted to authenticated users with the admin role. You must include a valid JWT in every request. Non-admin tokens receive 403 Forbidden; missing or expired tokens receive 401 Unauthorized.

Authentication requirement

Every request to an /admin/* endpoint must include the following header:
Authorization: Bearer <token>
Tokens are issued at login. If the token is missing or invalid the server responds with 401. If the token is valid but the user’s role is not admin, the server responds with 403.

GET /admin/summary

Returns dashboard statistics for the admin panel. All counts can be scoped to a specific season via the optional season_id query parameter.

Query parameters

season_id
number
Filter stats and recent activity to a specific season. Omit to return global counts.

Response

stats
object
required
Aggregate counts for the league.
recentActivity
array
required
The five most recent audit log entries, optionally filtered by season.

Example

cURL
curl --request GET \
  --url 'http://localhost:3000/admin/summary?season_id=3' \
  --header 'Authorization: Bearer <token>'

GET /admin/active-season

Returns the currently active season object. Returns 404 if no season has is_active = true.

GET /admin/logs

Paginated list of all audit log entries. Supports filtering by season, username, and date.

Query parameters

page
number
default:"1"
Page number (1-indexed).
limit
number
default:"20"
Number of entries per page.
season_id
number
Filter entries to a specific season (includes entries with no season).
username
string
Case-insensitive partial match on the acting user’s username.
date
string
Exact date filter in YYYY-MM-DD format.

Response

logs
array
required
Array of audit log entries matching the filters. See the entry structure above under recentActivity.
total
number
required
Total number of matching entries (for pagination).
page
number
required
Current page number.
limit
number
required
Page size used for this response.

GET /admin/users

Returns a paginated list of all active users with their roles and account metadata.

Query parameters

Case-insensitive partial match on username or email.
page
number
default:"1"
Page number.
limit
number
default:"10"
Results per page.

Response

users
array
required
List of user objects containing id, username, email, role, and created_at.
total
number
required
Total active users matching the query.
page
number
required
Current page.
limit
number
required
Page size.

PUT /admin/users/:id

Updates the role of a user. Valid roles are admin, referee, and user.

Path parameters

id
number
required
ID of the user to update.

Request body

role
string
required
New role to assign. One of admin, referee, or user.

DELETE /admin/users/:id

Deactivates a user account and anonymizes their username and email. This is a soft delete — the user record is retained but the account becomes inaccessible.

Path parameters

id
number
required
ID of the user to deactivate.

Every action performed through the admin endpoints is automatically recorded in the audit_logs table, including the acting admin’s ID, the affected entity, and a JSONB details payload.

Build docs developers (and LLMs) love