Behaviour and struct builder for CQRS commands.
A command represents an intent to change the system state. Commands are validated, authorized, and dispatched to a handler.
Defining a command
defmodule MyApp.Tasks.Commands.StartAssessment do
use Orkestra.Command
param :repo, :string, required: true
param :branch, :string, default: "main"
param :expert_name, :string, required: true
param :action_name, :string, required: true
param :montini_software_folder_url, :string, required: true
param :action_params, :map, default: %{}
endBuilding a command
{:ok, cmd} = StartAssessment.new(%{
repo: "owner/repo",
expert_name: "architect",
action_name: "perform-assessment",
montini_software_folder_url: "tasks/task_123"
})
cmd.id # auto-generated
cmd.params.repo # "owner/repo"
Summary
Types
Callbacks
@callback param_definitions() :: [param_definition()]