ash_postgres/test/support/resources/record.ex

40 lines
687 B
Elixir
Raw Normal View History

defmodule AshPostgres.Test.Record do
@moduledoc false
use Ash.Resource,
domain: AshPostgres.Test.Domain,
data_layer: AshPostgres.DataLayer
attributes do
2024-01-11 02:34:23 +13:00
uuid_primary_key(:id)
attribute(:full_name, :string, allow_nil?: false, public?: true)
timestamps(public?: true)
end
relationships do
alias AshPostgres.Test.Entity
has_one :entity, Entity do
public?(true)
2024-01-11 02:34:23 +13:00
no_attributes?(true)
2024-01-11 02:34:23 +13:00
read_action(:read_from_temp)
2024-01-11 02:34:23 +13:00
filter(expr(full_name == parent(full_name)))
end
end
postgres do
table "records"
repo AshPostgres.TestRepo
end
actions do
default_accept(:*)
2024-01-11 02:34:23 +13:00
defaults([:create, :read])
end
end