Documentation Index
Fetch the complete documentation index at: https://docs.auction-rise.com/llms.txt
Use this file to discover all available pages before exploring further.
Audit Logs
Theaudit_logs table provides a tamper-evident record of mutations in your application. Each entry captures who did what, to which resource, and when.
Schema
| Column | Type | Description |
|---|---|---|
id | uuid | Primary key |
workspace_id | uuid (nullable) | Scopes the event to a workspace |
actor_id | uuid | The authenticated user who performed the action |
action | text | Dot-namespaced action string (e.g., member.invited) |
resource_type | text | What kind of resource was affected (e.g., invitation) |
resource_id | uuid (nullable) | ID of the affected resource |
metadata | jsonb (nullable) | Extra context (role, email, old values, etc.) |
ip_address | inet (nullable) | Request IP (populate manually if needed) |
created_at | timestamptz | When the event occurred |
Recording an Event
ImportauditLog from @/lib/audit/log and call it after any mutation in a server action:
console.error without breaking the calling action.
Action Naming Convention
Use dot-namespaced strings that read asnoun.verb:
Querying Audit Logs
UseAuditLogFilters to query with pagination:
RLS Policy
Audit logs are readable by workspace members (scoped to their workspace) and by super admins (all logs). Inserts are only allowed from authenticated sessions (actors can only log their own actions).Adding Audit Logs to New Features
When adding a new server action that mutates data, add anauditLog() call as the last step:
- Perform the mutation.
- Check for errors and return early if needed.
- Call
auditLog(...)— fire and forget, noawaitneeded if you don’t care about the result.