Sigra.Workers.AccountDeletion (Sigra v1.20.0)

Copy Markdown View Source

Oban worker for executing scheduled account deletions.

Scheduled by Sigra.Account.Deletion.schedule/3 when a grace period is configured. The job fires at scheduled_deletion_at and applies the configured deletion strategy.

Implements Sigra.Workers so the perform callback receives a reconstructed, audit-only %Scope{} built from the stringified args.

Job Args

Required by Sigra.Workers.new/3:

  • "organization_id" - May be nil. Resolves to scope.active_organization.
  • "actor_id" - May be nil. The user who enqueued the job.

Required by this worker's perform/2 (belt + suspenders via Sigra.Workers.fetch_arg!/2):

  • "user_id" - The user ID to delete.
  • "strategy" - Deletion strategy ("soft_delete", "hard_delete", "anonymize").
  • "repo" - Repo module as a stringified module name.
  • "user_schema" - User schema as a stringified module name.
  • "scope_module" - Host scope module as a stringified module name.
  • "organization_schema" - Organization schema stringified, or nil.
  • "audit_schema" - Audit event schema as a stringified module name.
                           Required for `account.deletion_executed`
                           emission.

Optional:

  • "user_token_schema"
  • "session_store"
  • "identity_schema"
  • "api_token_schema"
  • "mfa_credential_schema"
  • "backup_code_schema"

Queue

Uses :sigra_lifecycle queue. Host apps must add this to their Oban config:

config :my_app, Oban,
  queues: [sigra_lifecycle: 5, sigra_mailer: 10]