Skip to content

Audit

concept
2 min readUpdated

The Audit subsystem manages audit-trail access and exports across organization-wide and project scopes. AuditController handles organization queries, filter facets, and CSV or JSON exports through queryOrg, orgFacets, and exportOrg, while query, exportCSV, and exportJSON cover project audit trails. AuditService records or retrieves audit information against the Database, using the standardized AUDIT_ACTIONS taxonomy and AuditAction inputs.

12 entities in atloria-monorepo/apps/api/src/audit. 9 other subsystems depend on it, which makes it the 6th most depended-upon part of this codebase.

What it is made of

Its 12 entities sit in 4 files under atloria-monorepo/apps/api/src/audit: 6 HTTP endpoints, 1 controller, 1 module, 1 service and 3 more. audit.controller.ts holds 7 of them — more than any other file here. AuditService declares 4 methods, the widest surface here.

Where work enters

1 controller publishes 6 GET endpoints. They answer under /audit. Every one of them declares a guard — JwtAuthGuard on 6 and OrganizationGuard on 6.

  • AuditControlleratloria-monorepo/apps/api/src/audit/audit.controller.ts:16
  • queryOrgatloria-monorepo/apps/api/src/audit/audit.controller.ts:27
  • orgFacetsatloria-monorepo/apps/api/src/audit/audit.controller.ts:55
  • exportOrgatloria-monorepo/apps/api/src/audit/audit.controller.ts:63
  • queryatloria-monorepo/apps/api/src/audit/audit.controller.ts:104
  • exportCSVatloria-monorepo/apps/api/src/audit/audit.controller.ts:128

How work moves through it

mermaid
flowchart LR
  AuditController0["AuditController"]
  AuditService10["AuditService"]
  AuditController0 --> AuditService10
  PrismaService20["PrismaService"]
  AuditService10 --> PrismaService20

Work enters at AuditController and passes through 2 other components. Each step below is a dependency edge between two entities in this repository, followed outward in order.

  1. AuditController takes the work first — atloria-monorepo/apps/api/src/audit/audit.controller.ts:16.
  2. Next, AuditController hands off to AuditServiceatloria-monorepo/apps/api/src/audit/audit.service.ts:19.
  3. Finally, AuditService hands off to PrismaServiceatloria-monorepo/libs/database/src/lib/prisma.service.ts:28.

When a step fails

  • AuditService handles failure in 1 place: it logs it and continues in all 1.
  • PrismaService handles failure in 1 place: it lets it reach the caller in all 1.

How it refuses and fails

1 of its components records a refusal or a failure handler. Its catch blocks handle a failure that already happened in 1 place.

Boundaries

9 other subsystems depend on this oneApi, Auth, Branding, Doc Version, Invitation, Platform, Project, Reader Access, Scim. Changing what it exposes changes them.

Those 9 hold 21 edges between them, unevenly: Doc Version reaches in across 4 edges, while another holds one. 21 edges arrive against 2 leaving — more of this repository reaches into it than it reaches out to. What they reach is narrower than the folder: 2 of its 12 members carry every inbound edge — AuditService (12) and AuditModule (9).

It depends on Database, and on nothing else in this repository.

Was this page helpful?

Download as PDF
Audit — Atloria (self dogfood)