ash_admin/dev/resources/tickets/comment.ex
Zach Daniel 3061793e41 feat: support fully managed relationships
fix: various fixes
2021-03-21 21:46:46 -04:00

36 lines
647 B
Elixir

defmodule Demo.Tickets.Comment do
use Ash.Resource,
data_layer: AshPostgres.DataLayer,
extensions: [AshAdmin.Resource]
admin do
form do
field :comment, type: :long_text
end
end
actions do
create :create do
primary? true
end
create :create2
end
postgres do
repo Demo.Repo
polymorphic? true
end
attributes do
uuid_primary_key :id
attribute :comment, :string
attribute :resource_id, :uuid, allow_nil?: false
end
relationships do
belongs_to :commenting_customer, Demo.Tickets.Customer
belongs_to :commenting_representative, Demo.Tickets.Customer
end
end