mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 21:43:12 +12:00
37cc01957d
* 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`
38 lines
728 B
Elixir
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
|