summaryrefslogtreecommitdiff
path: root/app/graphql/types/user_type.rb
blob: 1ba37927b409273b264726ff40d0c661caa28e4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

module Types
  class UserType < BaseObject
    graphql_name 'User'

    authorize :read_user

    present_using UserPresenter

    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
    field :todos, Types::TodoType.connection_type, null: false,
          resolver: Resolvers::TodoResolver,
          description: 'Todos of this user'
  end
end