2021-03-16 08:51:17 +13:00
|
|
|
defmodule AshGraphql.Test.Comment do
|
|
|
|
@moduledoc false
|
|
|
|
|
|
|
|
use Ash.Resource,
|
|
|
|
data_layer: Ash.DataLayer.Ets,
|
|
|
|
extensions: [AshGraphql.Resource]
|
|
|
|
|
|
|
|
graphql do
|
|
|
|
type :comment
|
|
|
|
|
|
|
|
queries do
|
|
|
|
get :get_comment, :read
|
|
|
|
end
|
|
|
|
|
|
|
|
mutations do
|
|
|
|
create :create_comment, :create
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-05-05 01:31:39 +12:00
|
|
|
actions do
|
|
|
|
read :read do
|
|
|
|
primary?(true)
|
|
|
|
end
|
|
|
|
|
|
|
|
read :paginated do
|
|
|
|
pagination(required?: true, offset?: true, countable: true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-03-16 08:51:17 +13:00
|
|
|
attributes do
|
|
|
|
uuid_primary_key(:id)
|
2021-04-16 08:28:04 +12:00
|
|
|
attribute(:text, :string)
|
2021-03-16 08:51:17 +13:00
|
|
|
end
|
|
|
|
|
|
|
|
relationships do
|
|
|
|
belongs_to(:post, AshGraphql.Test.Post)
|
|
|
|
end
|
|
|
|
end
|