2022-12-18 01:57:25 +13:00
|
|
|
defmodule AshPostgres.Test.User do
|
|
|
|
@moduledoc false
|
|
|
|
use Ash.Resource, data_layer: AshPostgres.DataLayer
|
|
|
|
|
|
|
|
actions do
|
2022-12-18 20:23:39 +13:00
|
|
|
defaults([:create, :read, :update, :destroy])
|
2022-12-18 01:57:25 +13:00
|
|
|
end
|
|
|
|
|
|
|
|
attributes do
|
2022-12-18 20:23:39 +13:00
|
|
|
uuid_primary_key(:id)
|
|
|
|
attribute(:is_active, :boolean)
|
2023-11-16 14:56:09 +13:00
|
|
|
attribute(:name, :string)
|
2022-12-18 01:57:25 +13:00
|
|
|
end
|
2022-12-18 20:23:39 +13:00
|
|
|
|
2022-12-18 01:57:25 +13:00
|
|
|
postgres do
|
|
|
|
table "users"
|
|
|
|
repo(AshPostgres.TestRepo)
|
|
|
|
end
|
|
|
|
|
|
|
|
relationships do
|
2023-01-29 19:05:34 +13:00
|
|
|
belongs_to(:organization, AshPostgres.Test.Organization)
|
2022-12-18 20:23:39 +13:00
|
|
|
has_many(:accounts, AshPostgres.Test.Account)
|
2022-12-18 01:57:25 +13:00
|
|
|
end
|
2022-12-18 20:23:39 +13:00
|
|
|
end
|