Created
April 24, 2018 17:22
-
-
Save goodpic/95ca2b760b47c57b388edc7ea4346d3e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Types | |
class QueryType < GraphQL::Schema::Object | |
# Add root-level fields here. | |
# They will be entry points for queries on your schema. | |
# queries are represented as fields, use [Types::XXX] for the list | |
field :product, Types::ProductType, | |
null: true, | |
resolve: ->(_obj, args, _ctx) { | |
Product.find(args.id) | |
} do | |
argument :id, String, required: true | |
argument :days, Int, required: false | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment