Write the playbook. Your team reviews it as sentences.One EDN model: resources, actions, rules, effects and flows.
Records, who may do what, and what happens next, written as a model that zenn.ing reads back to you as plain sentences. If a rule is wrong, you can see that it is wrong, before it reaches a customer.The compiler checks every reference and expression. :allow decides whether a caller may act, :where what they can see, and :validate names its own error codes.
- Only staff add lines to an invoice.
- A line is charged to the penny, a half penny up.
- A unit price is in whole pence.
- Sending the invoice mails the customer.
:add-line
{:type :update :by [:id] … :allow [:check :staff]
:validate
[{:assert [:= [:decimal/compare
[:decimal/round [:input :unit-price] 2]
[:input :unit-price]] 0]
:code :invoice/unit-price-pence}]
:set {:total [:decimal/add [:field :total] …]}}