Skip to content

Instantly share code, notes, and snippets.

@maxloncar
Created March 9, 2023 13:13
Show Gist options
  • Save maxloncar/74a974536bba32d92141836474746873 to your computer and use it in GitHub Desktop.
Save maxloncar/74a974536bba32d92141836474746873 to your computer and use it in GitHub Desktop.
QueryType class
module Types
class QueryType < Types::BaseObject
field :authors, [Types::AuthorType], null: false
def authors
Author.all
end
field :author, Types::AuthorType, null: false do
argument :id, ID, required: true
end
def author(id:)
Author.find(id)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment