mirror of
https://github.com/ash-project/ash_graphql.git
synced 2024-09-20 21:32:59 +12:00
0c869aa522
An error occurs at compile time: == Compilation error in file test/support/schema.ex == ** (MatchError) no match of right hand side value: {:error, "Must provide field type for max"} lib/resource/resource.ex:2278: AshGraphql.Resource.filterable?/2 (elixir 1.15.4) lib/enum.ex:4265: Enum.filter_list/2 (elixir 1.15.4) lib/enum.ex:4266: Enum.filter_list/2 lib/resource/resource.ex:2229: AshGraphql.Resource.aggregate_filter_fields/2 lib/resource/resource.ex:2195: AshGraphql.Resource.resource_filter_fields/2 lib/resource/resource.ex:1159: AshGraphql.Resource.args/5 lib/resource/resource.ex:425: anonymous fn/6 in AshGraphql.Resource.queries/5 (elixir 1.15.4) lib/enum.ex:1693: Enum."-map/2-lists^map/1-1-"/2
60 lines
1 KiB
Elixir
60 lines
1 KiB
Elixir
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
|
|
list :list_comments, :read
|
|
end
|
|
|
|
mutations do
|
|
create :create_comment, :create
|
|
end
|
|
end
|
|
|
|
actions do
|
|
defaults([:create, :update, :destroy])
|
|
|
|
read :read do
|
|
primary?(true)
|
|
end
|
|
|
|
read :paginated do
|
|
pagination(required?: true, offset?: true, countable: true)
|
|
end
|
|
end
|
|
|
|
attributes do
|
|
uuid_primary_key(:id)
|
|
attribute(:text, :string)
|
|
|
|
attribute :type, :atom do
|
|
writable?(false)
|
|
default(:comment)
|
|
end
|
|
|
|
create_timestamp(:created_at)
|
|
end
|
|
|
|
calculations do
|
|
calculate(
|
|
:timestamp,
|
|
:utc_datetime_usec,
|
|
expr(created_at)
|
|
)
|
|
end
|
|
|
|
relationships do
|
|
belongs_to(:post, AshGraphql.Test.Post)
|
|
|
|
belongs_to :author, AshGraphql.Test.User do
|
|
attribute_writable?(true)
|
|
end
|
|
end
|
|
end
|