spec/support/star_wars/schema.rb in graphql-1.6.4 vs spec/support/star_wars/schema.rb in graphql-1.6.5
- old
+ new
@@ -302,11 +302,14 @@
resolve ->(obj, args, ctx) { Base.find(3) }
end
connection :newestBasesGroupedByFaction, BaseType.connection_type do
resolve ->(obj, args, ctx) {
- Base.order('sum(faction_id) desc').group(:faction_id)
+ Base
+ .having('id in (select max(id) from bases group by faction_id)')
+ .group(:id)
+ .order('faction_id desc')
}
end
connection :basesWithNullName, BaseType.connection_type do
resolve ->(obj, args, ctx) {
@@ -357,10 +360,10 @@
Schema = GraphQL::Schema.define do
query(QueryType)
mutation(MutationType)
default_max_page_size 3
- resolve_type ->(object, ctx) {
+ resolve_type ->(type, object, ctx) {
if object == :test_error
:not_a_type
elsif object.is_a?(Base)
BaseType
elsif DATA["Faction"].values.include?(object)