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

Copy Markdown View Source

Adds a review workflow to a resource

Generates a review resource that runs the review workflow for the subject resource, and a decision resource with one row per review round. A reviewer approves, rejects or requests changes, and the requester resubmits after changes are requested. The subject gains has_many :reviews, has_one :latest_review and a review_approved? calculation. When the subject does not exist, it is created with mix ash.gen.resource first.

Nobody may request or review until the application defines who can, in the generated Checks.CanRequest and Checks.CanReview modules.

Example

mix ash_workflow.gen.review MyApp.Content.Article --reviewer MyApp.Accounts.User --overdue-after 3d

Options

  • --reviewer - required. The actor resource. Decisions and the requester belong to it.
  • --module - the review resource's module name. Defaults to the subject's name with Review appended.
  • --domain - the domain for a subject the task creates. Required only when the subject does not exist.
  • --overdue-after - moves a review the reviewer has not decided to :overdue this long after it was last submitted, given as 30m, 12h, 2d or 2w. A duration under a minute needs AshWorkflow.Scheduler.Precise. Without it, no :overdue step is generated.
  • --transition-log - also generates a transition log for the review with mix ash_workflow.gen.transition_log. Defaults to true.