mirror of
https://github.com/ash-project/ash_admin.git
synced 2024-09-21 05:43:19 +12:00
37 lines
647 B
Elixir
37 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
|