AuditLogEntry

final class AuditLogEntry : Model, @unchecked Sendable

One entry in the server’s audit log: an administrative or system event that doesn’t already have a log of its own, such as a settings change, an auto-quarantine, or a role grant. The log is append-only–there are no update or delete routes.

actor is nil for events the server initiates itself (auto-quarantine). Both user relations are set to null if the user is deleted, so deleting an account never removes the history.

See

See Also: AuditEventType for the events recorded. ModeratorAction and CommunitySupportAction are separate, domain-specific logs.

Properties

  • id

    Declaration

    Swift

    @AuditLogEntry
    .ID var id: UUID? { get set }
  • What happened. Stored as a string.

    Declaration

    Swift

    @AuditLogEntry
    .Field var eventType: AuditEventType { get set }
  • What it happened to, as a short string, e.g. "settings", "twarrt:1234", "role:communitysupport".

    Declaration

    Swift

    @AuditLogEntry
    .Field var subject: String { get set }
  • Event-specific details. Keys and values are plain strings so the shape can change without a migration.

    Declaration

    Swift

    @AuditLogEntry
    .Field var details: [String : String] { get set }
  • Declaration

    Swift

    @AuditLogEntry
    .Timestamp var createdAt: Date? { get set }

Relations

  • The user who did it. Nil for system events.

    Declaration

    Swift

    @AuditLogEntry
    .OptionalParent var actor: User? { get set }
  • The user the event was done to or about, if any (the author of auto-quarantined content, the user receiving a role).

    Declaration

    Swift

    @AuditLogEntry
    .OptionalParent var targetUser: User? { get set }

Initialization