Files

35 lines
1.2 KiB
Markdown

# Audit Log
## User Perspective
The Change History page (`/audit`) shows a chronological log of all user-initiated changes to the workspace. Useful for tracking who changed what and when.
Each entry shows: actor, entity type, entity ID, action (create/update/delete), timestamp, and before/after JSON snapshots (expandable).
## Developer Perspective
### AuditService
```typescript
AuditService.log(
actorId: string,
entityType: string, // 'Video', 'Template', 'DescriptionBlock', etc.
entityId: string,
action: string, // 'create', 'update', 'delete'
before?: object,
after?: object
)
```
### When to Log
Every user-facing mutation (create/update/delete) must call `AuditService.log()`. Background/system operations (queue processors, channel import) do NOT log.
### Adding Audit Logging to a Module
1. Import `AuditModule` in the module's `@Module({ imports: [...] })` array
2. Inject `AuditService` in the service constructor
3. Call `AuditService.log()` in each mutation method
### Tracked Entities
`Video`, `VideoConfig`, `DescriptionBlock`, `Template`, `Collaborator`, `TeamVariable`, `SavedView`, `TeamMember`
## Related
- [[02 - Backend]] (architecture)