Good morning ladies and gents,
I’d have a quick question regarding the Absinthe queries.
Is this following query possible at all:
{ users(order: DESC) { id email clients(order: ASC) { id email } } }
I couldn’t find any examples describing how to implement these nested queries. So far I’ve only managed to use arguments on the root level, like order: DESC, client_order: ASC, but that doesn’t look very clean.
I did this with my schema:
query do
field :users, list_of(:user) do
arg :order, :sorting
resolve &Resolvers.users/3
end
end
object :user do
field :id, :id
field :email, :string
field :clients, list_of(:user)
end
I then tried to create a query for “clients” like this:
query do
field :clients, list_of(:user) do
arg :order, :sorting
resolve &Resolvers.users/3
end
end
but that doesn’t seem to do anything at all.
The error message I get when trying to add the arguments in the query is "message": "Unknown argument "order" on field "clients" of type "User".