Service Layer medium complexity backend
2
Dependencies
2
Dependents
3
Entities
0
Integrations

Description

Backend service that handles all read queries against the audit_logs table. Supports pagination, multi-field filtering, and date range queries using the required composite indexes on (organization_id, created_at) and (actor_id, created_at). Enforces tenant isolation by default; cross-tenant Global Admin queries require explicit opt-in and are themselves logged via AuditService.

Feature: Audit Log

audit-query-service

Responsibilities

  • Execute paginated, filtered queries against audit_logs using indexed fields
  • Enforce per-tenant isolation - scope all queries to organization_id unless Global Admin
  • Log cross-tenant Global Admin query requests back through AuditService
  • Support CSV export generation for compliance evidence packages
  • Validate date range bounds and prevent unbounded full-table scans

Interfaces

queryLogs(filters: AuditLogFilters, page: number, pageSize: number): Promise<PaginatedAuditLogs>
getEventDetail(eventId: string, requestingActorId: string): Promise<AuditEvent>
exportCsv(filters: AuditLogFilters, requestingActorId: string): Promise<ReadableStream>
countEvents(filters: AuditLogFilters): Promise<number>

Relationships

Dependencies (2)

Components this component depends on

Dependents (2)

Components that depend on this component

Related Data Entities (3)

Data entities managed by this component