ash/test/support/flow/user.ex
Zach Daniel b20c4afd9b improvement: haltable flows, branch step type
fix: fix chart links rendering
2022-10-06 17:04:44 -04:00

49 lines
936 B
Elixir

defmodule Ash.Test.Flow.User do
@moduledoc false
use Ash.Resource, data_layer: Ash.DataLayer.Mnesia
actions do
defaults [:read, :destroy]
read :for_org do
argument :org, :uuid, allow_nil?: false
filter(expr(org_id == ^arg(:org)))
end
create :create do
argument :org, :uuid, allow_nil?: false
change manage_relationship(:org, type: :append_and_remove)
end
update :update do
primary? true
end
update :approve do
accept []
change set_attribute(:approved, true)
end
update :unapprove do
accept []
change set_attribute(:approved, false)
end
end
attributes do
uuid_primary_key :id
attribute :first_name, :string
attribute :last_name, :string
attribute :email, :string
attribute :approved, :boolean do
private? true
end
end
relationships do
belongs_to :org, Ash.Test.Flow.Org
end
end