ash_admin/dev/resources/tickets/comment.ex

37 lines
647 B
Elixir
Raw Normal View History

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