From c96d1c460a2b2e9f2da555dfe4c9bb05389d6350 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Miedes=20Garc=C3=A9s?= Date: Wed, 12 Oct 2016 17:56:24 +0200 Subject: [PATCH] Ability to query for a specific User --- app/graph/types/query_root.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/graph/types/query_root.rb b/app/graph/types/query_root.rb index 007271932..0c3ed66b9 100644 --- a/app/graph/types/query_root.rb +++ b/app/graph/types/query_root.rb @@ -49,4 +49,14 @@ QueryRoot = GraphQL::ObjectType.define do Comment.all } end + + field :user do + type UserType + description "Find a User by id" + argument :id, !types.ID + resolve -> (object, arguments, context) { + User.find(arguments["id"]) + } + end + end