ash_postgres/test/support/resources/post_views.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

38 lines
728 B
Elixir

defmodule AshPostgres.Test.PostView do
@moduledoc false
use Ash.Resource,
domain: AshPostgres.Test.Domain,
data_layer: AshPostgres.DataLayer
actions do
default_accept(:*)
defaults([:create, :read])
end
attributes do
create_timestamp(:time)
attribute(:browser, :atom, constraints: [one_of: [:firefox, :chrome, :edge]], public?: true)
end
relationships do
belongs_to :post, AshPostgres.Test.Post do
public?(true)
allow_nil?(false)
attribute_writable?(true)
end
end
resource do
require_primary_key?(false)
end
postgres do
table "post_views"
repo AshPostgres.TestRepo
references do
reference :post, ignore?: true
end
end
end