Adds an approval workflow to a resource
Generates an approval resource that runs the approval workflow for the
subject resource, and a decision resource with one row per approver.
The subject gains has_many :approvals, has_one :latest_approval and an
approved? calculation. When the subject does not exist, it is created
with mix ash.gen.resource first.
Nobody may open a request or approve until the application defines who
can, in the generated Checks.CanRequest and Checks.CanApprove modules.
Example
mix ash_workflow.gen.approval MyApp.Expenses.Expense --approver MyApp.Accounts.User --overdue-after 2d
Options
--approver- required. The actor resource. Decisions and the requester belong to it.--module- the approval resource's module name. Defaults to the subject's name withApprovalappended.--domain- the domain for a subject the task creates. Required only when the subject does not exist.--required-approvals- the number of approvals a request needs. Defaults to1.--overdue-after- moves a request nobody has decided to:overdueafter this long, given as30m,12h,2dor2w. A duration under a minute needsAshWorkflow.Scheduler.Precise. Without it, no:overduestep is generated.--transition-log- also generates a transition log for the approval withmix ash_workflow.gen.transition_log. Defaults totrue.