mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 05:23:03 +12:00
b20c4afd9b
fix: fix chart links rendering
49 lines
936 B
Elixir
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
|