2024-02-11 06:02:56 +13:00
|
|
|
defmodule AshGraphql.Test.Message do
|
|
|
|
@moduledoc false
|
|
|
|
|
|
|
|
use Ash.Resource,
|
2024-04-02 07:03:06 +13:00
|
|
|
domain: AshGraphql.Test.Domain,
|
2024-02-11 06:02:56 +13:00
|
|
|
data_layer: Ash.DataLayer.Ets
|
|
|
|
|
|
|
|
# extensions: [AshGraphql.Resource]
|
|
|
|
|
|
|
|
ets do
|
|
|
|
table(:message)
|
|
|
|
end
|
|
|
|
|
|
|
|
actions do
|
2024-04-02 07:03:06 +13:00
|
|
|
default_accept(:*)
|
2024-02-11 06:02:56 +13:00
|
|
|
defaults([:read, :update, :destroy])
|
|
|
|
|
|
|
|
create :create do
|
|
|
|
primary?(true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
attributes do
|
|
|
|
uuid_primary_key(:id)
|
|
|
|
|
2024-04-02 07:03:06 +13:00
|
|
|
attribute(:text, :string, public?: true)
|
2024-02-11 06:02:56 +13:00
|
|
|
|
2024-04-02 07:03:06 +13:00
|
|
|
attribute(:type, :atom, default: :text, constraints: [one_of: [:text, :image]], public?: true)
|
2024-02-11 06:02:56 +13:00
|
|
|
end
|
|
|
|
|
|
|
|
relationships do
|
2024-04-02 07:03:06 +13:00
|
|
|
belongs_to(:channel, AshGraphql.Test.Channel, public?: true)
|
2024-02-11 06:02:56 +13:00
|
|
|
end
|
|
|
|
|
|
|
|
# graphql do
|
|
|
|
# type :message
|
|
|
|
# end
|
|
|
|
end
|