PrintHeritage maintains a tamper-evident audit trail of every significant action performed on the platform. Every time a user logs in, creates or modifies a resource, or changes team membership, a record is written to theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/joaomonteir0/printheritage/llms.txt
Use this file to discover all available pages before exploring further.
audit_logs table. The Auditoria do Sistema page surfaces these records in a searchable, colour-coded table that is restricted to SUPER_ADMIN users only.
AuditLog Data Model
Audit records are stored in theaudit_logs table, backed by the following SQLAlchemy model:
user_id field references the user who performed the action. The target_type and target_id fields identify which entity was affected. The optional details field carries a human-readable description (for example, the email address of a newly created user).
Retrieving Audit Logs
The audit log endpoint is accessible only to authenticated users with theSUPER_ADMIN global role:
AuditLog with the User table on user_id and returns rows ordered by timestamp descending (newest first). Each row in the response is a composite object:
All Logged Actions
The following table lists every action type emitted by the auth service, along with the associatedtarget_type and a description of what triggers it.
| Action | Target Type | Triggered When |
|---|---|---|
USER_LOGIN | USER | A user successfully authenticates and receives a JWT. |
USER_CREATED | USER | A new user account is created via POST /register. The details field records the new user’s email. |
USER_UPDATE | USER | A user’s profile or global role is modified via PATCH /users/{user_id}. |
USER_DELETE | USER | A user account is permanently removed via DELETE /users/{user_id}. |
PROJECT_CREATE | PROJECT | A new project is created. |
PROJECT_DATA_ADD | PROJECT | A new dataset is attached to a project via PATCH /projects/{project_id}/data. |
PROJECT_DATA_DELETE | PROJECT | A dataset is deleted from a project. |
PROJECT_MEMBER_INVITE | USER | An invitation is sent to a user to join a project. The target_id is the invited user’s ID. |
PROJECT_MEMBER_REMOVE | USER | A member is removed from a project’s team. |
INVITE_ACCEPT | PROJECT | An invited user accepts their pending project invitation. |
INVITE_REJECT | PROJECT | An invited user rejects their pending project invitation. |
PASSWORD_CHANGE | USER | A user successfully changes their own password. |
Table Columns
The Auditoria do Sistema page renders all logs in a scrollable table with the following columns:| Column | Source Field | Notes |
|---|---|---|
| Data / Hora | AuditLog.timestamp | Formatted with toLocaleString(). |
| Utilizador | email | The email of the actor, resolved from the User join. |
| Ação | AuditLog.action | Colour-coded badge (see below). |
| Alvo | AuditLog.target_type + target_id | target_id is truncated to the first 8 characters for display. |
| Detalhes | AuditLog.details | Free-text context; truncated at max-w-xs. Displays — when null. |
Colour Coding
Action badges are colour-coded by thegetActionColor function, which matches on substrings of the action string:
Green — Create / Accept
Actions containing
CREATE or ACCEPT are rendered with an emerald badge (text-emerald-500 bg-emerald-500/10). These represent successful additions and positive responses to invitations.Red — Delete / Reject
Actions containing
DELETE or REJECT are rendered with a red badge (text-red-500 bg-red-500/10). These represent destructive or declined operations.Blue — Update
Actions containing
UPDATE are rendered with a blue badge (text-blue-500 bg-blue-500/10). All other actions fall back to a neutral slate badge.Loading and Empty States
- While the initial
GET /audit-logsrequest is in flight, the table body shows an animated A ler registos… placeholder across all five columns. - If the response returns an empty array, the table body shows Nenhuma atividade registada. in italics.