consistent expectations of how the other components around them work, you can ultimately do a significant amount more, with less.“ https://ash-hq.org/docs/guides/ash/latest/tutorials/why-ash
"tasks" repo App.Repo end attributes do uuid_primary_key :id attribute :content, :string, allow_nil?: false attribute :position, :integer, allow_nil?: false end end
:id attribute :name, :string attribute :price, :decimal end relationships do belongs_to :category, App.Shop.Category do attribute_writable? true end end # ...
want to serve apis: [App.ToDoList], # optionally a json_schema route json_schema: "/json_schema", # optionally an open_api route open_api: "/open_api" end
action_type(:read) do # unless the actor is an active user, forbid forbid_unless actor_attribute_equals(:active, true) # if the record is marked as public, authorize authorize_if attribute(:public, true) # if the actor is related to the data via that data's `owner` relationship, authorize authorize_if relates_to_actor_via(:owner) end end