mix ash_workflow.gen.verification (AshWorkflow v0.12.0)

Copy Markdown View Source

Adds a verification workflow to a resource

Generates a verification resource whose :verifying step runs a :verify action the application fills in, such as a call to an outside provider. The action's outcome routes a verification to :verified or :rejected, and one that fails every attempt moves to :needs_review for a person to decide. The subject gains has_many :verifications, has_one :latest_verification and a verified? calculation. When the subject does not exist, it is created with mix ash.gen.resource first.

Nobody may submit a verification, or decide one in review, until the application defines who can, in the generated Checks.CanSubmit and Checks.CanReview modules.

Example

mix ash_workflow.gen.verification MyApp.Accounts.IdentityDocument --max-attempts 5

Options

  • --module - the verification resource's module name. Defaults to the subject's name with Verification appended.
  • --domain - the domain for a subject the task creates. Required only when the subject does not exist.
  • --max-attempts - attempts :verify gets before the verification moves to :needs_review. Defaults to 3. With 1, no retry block is generated.
  • --transition-log - also generates a transition log for the verification with mix ash_workflow.gen.transition_log. Defaults to true.