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.

Every significant action performed by an admin or referee is recorded in the audit log. Use the logs to trace who changed what, when, and in what context — useful for debugging, accountability, and compliance.

What gets logged

The following actions produce an audit log entry: Match management
  • Creación de partido — A new fixture was created
  • Eliminación lógica de partido — A fixture was moved to trash
  • Restauración de partido — A fixture was restored from trash
  • Eliminación permanente de partido — A fixture was permanently deleted
  • Actualización de equipos — Team assignments on a fixture were updated
  • Añadir evento — A match event (goal, card, penalty) was recorded
  • Finalización de partido — A match was finished; standings and porra scores updated
Season management
  • Creación de temporada — A new season was created
  • Actualización de temporada — A season was edited
  • Eliminación de temporada — A season was deleted
  • Importación de estructura de temporada — A season’s structure was imported from another season
User management
  • Actualización de usuario — A user’s role was changed
  • Desactivación de usuario (Admin) — A user account was deactivated and anonymised by an admin
Other
  • Image uploads via the admin upload endpoint

Log record fields

Each entry in the audit_logs table contains:
FieldTypeDescription
user_idintegerID of the admin or referee who performed the action
usernamestringUsername of the actor (joined from users)
actionstringHuman-readable action name (see list above)
entity_typestringType of entity affected: match, season, user, team, player, group, field
entity_idintegerID of the affected entity
detailsJSONBStructured context for the action (e.g. score at finish, role change, event type)
created_attimestampWhen the action was recorded

Accessing logs

Retrieve the full audit log with GET /admin/logs. This endpoint is restricted to admins.
GET /admin/logs
Authorization: Bearer <admin_token>
The response includes the log entries for the current page along with pagination metadata:
{
  "logs": [...],
  "total": 348,
  "page": 1,
  "limit": 20
}

Filtering

You can narrow results using any combination of the following query parameters:
ParameterDescription
season_idReturn only entries related to a specific season (matched against details.season_id)
usernamePartial, case-insensitive match on the actor’s username
dateExact date filter in YYYY-MM-DD format
GET /admin/logs?season_id=2&username=referee1&date=2025-03-15
Authorization: Bearer <admin_token>

Pagination

Use page and limit query parameters to paginate results. The default page size is 20 entries per page.
GET /admin/logs?page=2&limit=50
Authorization: Bearer <admin_token>
Use the total field in the response to calculate the number of available pages: Math.ceil(total / limit).

Dashboard preview

The admin dashboard (GET /admin/summary) includes a recentActivity field containing the last 5 audit log entries. This provides a quick overview of recent activity without needing to open the full log view. If a season_id is passed to the summary endpoint, the preview is filtered to that season’s entries.
{
  "stats": { ... },
  "recentActivity": [
    {
      "id": 412,
      "action": "Finalización de partido",
      "entity_type": "match",
      "entity_id": 42,
      "username": "admin_user",
      "details": { "home_goals": 3, "away_goals": 1, "season_id": "2" },
      "created_at": "2025-03-15T19:45:22.000Z"
    },
    ...
  ]
}

Build docs developers (and LLMs) love