Service Layer medium complexity backend
0
Dependencies
0
Dependents
19
Entities
0
Integrations

Description

Handles all business logic for audit log operations including writing append-only entries, enforcing immutability, and orchestrating filtered queries and exports. Acts as the authoritative boundary between application events and the audit log storage layer.

Feature: Audit Log

audit-log-service

Sources & reasoning

Line 259 states an explicit hard requirement: every Global Admin support-access session must be logged in the org's audit trail. admin-security is always-on (line 241), fixing the target release at MVP. GDPR obligations for health data and encrypted assignments reinforce the critical priority; no later phase can satisfy the compliance requirement that audit trail coverage begins from day one.

  • docs/source/likeperson.md · line 259
    Every support-access session is logged in the org's audit trail.
  • docs/source/likeperson.md · line 239-241
    Always-on core. A small set of modules is non-toggleable because the operational products are meaningless without them... Admin Web Portal: `admin-dashboard`, `admin-user-management`, `admin-organization`, `admin-security`.

Responsibilities

  • Write new audit entries atomically with full context (actor, action, timestamp, session)
  • Enforce append-only invariant - no update or delete operations permitted after write
  • Validate and apply filter criteria for scoped queries by organization
  • Orchestrate export generation in CSV or JSON format for compliance use
  • Emit audit events for authentication, admin changes, sensitive data access, and support sessions

Interfaces

logEvent(event: AuditEventInput): Promise<AuditEntry>
queryEntries(orgId: string, filters: AuditLogFilters, page: number): Promise<PagedAuditLog>
exportEntries(orgId: string, filters: AuditLogFilters, format: ExportFormat): Promise<Buffer>
getEntry(entryId: string): Promise<AuditEntry>