ash_postgres/test/support/resources/organization.ex
Zach Daniel 37cc01957d
improvement!: 3.0 (#227)
* WIP

* chore: fix mix.lock merge issues

* improvement: upgrade to 3.0

* chore: remove `repo.to_tenant`

* chore: continue removal of unnecessary helper

* chore: use `Ash.ToTenant`
2024-03-27 16:52:28 -04:00

51 lines
917 B
Elixir

defmodule AshPostgres.Test.Organization do
@moduledoc false
use Ash.Resource,
domain: AshPostgres.Test.Domain,
data_layer: AshPostgres.DataLayer,
authorizers: [
Ash.Policy.Authorizer
]
postgres do
table("orgs")
repo(AshPostgres.TestRepo)
end
policies do
policy always() do
authorize_if(always())
end
end
field_policies do
field_policy :* do
authorize_if(always())
end
end
actions do
default_accept(:*)
defaults([:create, :read, :update, :destroy])
end
attributes do
uuid_primary_key(:id, writable?: true)
attribute(:name, :string, public?: true)
end
relationships do
has_many(:users, AshPostgres.Test.User) do
public?(true)
end
has_many(:posts, AshPostgres.Test.Post) do
public?(true)
end
has_many(:managers, AshPostgres.Test.Manager) do
public?(true)
end
end
end