-
The following simple query is not returning
Here's the resolver: module Resolvers
class Observations < Resolvers::BaseResolver
type Types::Models::ObservationType.connection_type, null: false
description "List or filter all observations"
def resolve
::Observation.order(created_at: :desc)
end
end
end Base resolver module Resolvers
class BaseResolver < GraphQL::Schema::Resolver
end
end Query type # graphql/types/query_type.rb
require("graphql/batch")
require("loaders/record_loader")
require("search_object")
require("search_object/plugin/graphql")
module Types
class QueryType < Types::BaseObject
field :observations, Types::Models::ObservationType.connection_type, null: false, resolver: Resolvers::Observations Query (using Relay style cursor pagination) query getObservations {
observations {
pageInfo {
startCursor
endCursor
hasNextPage
hasPreviousPage
}
edges {
cursor
node {
id
thumbImageId
textName
where
when
createdAt
updatedAt
}
}
}
} Background: I'm planning on using a resolver for this model query because the eventual version will have a lot of filters built with |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Weird! I don't have a guess, looking at the snippets above. Maybe the |
Beta Was this translation helpful? Give feedback.
-
Agh. I forgot i had installed graphql-connections and added its connection type at the schema level - there it is at the top of the schema def. Sorry! That connection type orders by primary key by default - and does not implement desc ordering if you pass it a primary key. Not usable for me, i've disabled it. Queries back to behaving normally. |
Beta Was this translation helpful? Give feedback.
Agh. I forgot i had installed graphql-connections and added its connection type at the schema level - there it is at the top of the schema def. Sorry!
That connection type orders by primary key by default - and does not implement desc ordering if you pass it a primary key. Not usable for me, i've disabled it. Queries back to behaving normally.