2018-11-27 15:10:40 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Types
|
|
|
|
class UserType < BaseObject
|
|
|
|
graphql_name 'User'
|
|
|
|
|
2019-03-04 02:30:32 +00:00
|
|
|
authorize :read_user
|
|
|
|
|
2018-11-27 15:10:40 +00:00
|
|
|
present_using UserPresenter
|
|
|
|
|
2019-09-13 13:26:31 +00:00
|
|
|
field :name, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions
|
|
|
|
field :username, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions
|
|
|
|
field :avatar_url, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions
|
|
|
|
field :web_url, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions
|
2019-10-17 15:06:17 +00:00
|
|
|
field :todos, Types::TodoType.connection_type, null: false,
|
|
|
|
resolver: Resolvers::TodoResolver,
|
|
|
|
description: 'Todos of this user'
|
2018-11-27 15:10:40 +00:00
|
|
|
end
|
|
|
|
end
|