From 757e68969df8fd5443b5c6800ffa263e7efa2f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Miedes=20Garc=C3=A9s?= Date: Wed, 12 Oct 2016 17:57:56 +0200 Subject: [PATCH] Ability to access proposals, debates and comments authored by a specific user --- app/graph/types/user_type.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/graph/types/user_type.rb b/app/graph/types/user_type.rb index bb64b818f..922f51258 100644 --- a/app/graph/types/user_type.rb +++ b/app/graph/types/user_type.rb @@ -1,7 +1,9 @@ UserType = GraphQL::ObjectType.define do name "User" description "An user entry, returns basic user information" + # Expose fields associated with User model + field :id, !types.ID, "The id of this user" field :created_at, types.String, "Date when this user was created" field :username, types.String, "The username of this user" @@ -10,5 +12,18 @@ UserType = GraphQL::ObjectType.define do field :date_of_birth, types.String, "The birthdate of this user" # Linked resources + field :geozone, GeozoneType, "Geozone where this user is registered" + + connection :proposals, ProposalType.connection_type do + description "Proposals authored by this user" + end + + connection :debates, DebateType.connection_type do + description "Debates authored by this user" + end + + connection :comments, CommentType.connection_type do + description "Comments authored by this user" + end end