2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Types
|
|
|
|
class UserType < BaseObject
|
|
|
|
graphql_name 'User'
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
authorize :read_user
|
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
present_using UserPresenter
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
expose_permissions Types::PermissionTypes::User
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
field :id, GraphQL::ID_TYPE, null: false,
|
|
|
|
description: 'ID of the user'
|
2019-12-26 22:10:19 +05:30
|
|
|
field :username, GraphQL::STRING_TYPE, null: false,
|
|
|
|
description: 'Username of the user. Unique within this instance of GitLab'
|
2020-06-23 00:09:42 +05:30
|
|
|
field :name, GraphQL::STRING_TYPE, null: false,
|
|
|
|
description: 'Human-readable name of the user'
|
|
|
|
field :state, Types::UserStateEnum, null: false,
|
|
|
|
description: 'State of the user'
|
2020-10-24 23:57:45 +05:30
|
|
|
field :email, GraphQL::STRING_TYPE, null: true,
|
|
|
|
description: 'User email'
|
2020-03-13 15:44:24 +05:30
|
|
|
field :avatar_url, GraphQL::STRING_TYPE, null: true,
|
2019-12-26 22:10:19 +05:30
|
|
|
description: "URL of the user's avatar"
|
|
|
|
field :web_url, GraphQL::STRING_TYPE, null: false,
|
|
|
|
description: 'Web URL of the user'
|
2020-10-24 23:57:45 +05:30
|
|
|
field :web_path, GraphQL::STRING_TYPE, null: false,
|
|
|
|
description: 'Web path of the user'
|
2019-12-21 20:55:43 +05:30
|
|
|
field :todos, Types::TodoType.connection_type, null: false,
|
|
|
|
resolver: Resolvers::TodoResolver,
|
2019-12-26 22:10:19 +05:30
|
|
|
description: 'Todos of the user'
|
2020-06-23 00:09:42 +05:30
|
|
|
field :group_memberships, Types::GroupMemberType.connection_type, null: true,
|
|
|
|
description: 'Group memberships of the user',
|
|
|
|
method: :group_members
|
2020-10-24 23:57:45 +05:30
|
|
|
field :status, Types::UserStatusType, null: true,
|
|
|
|
description: 'User status'
|
2020-06-23 00:09:42 +05:30
|
|
|
field :project_memberships, Types::ProjectMemberType.connection_type, null: true,
|
|
|
|
description: 'Project memberships of the user',
|
|
|
|
method: :project_members
|
|
|
|
|
|
|
|
# Merge request field: MRs can be either authored or assigned:
|
|
|
|
field :authored_merge_requests, Types::MergeRequestType.connection_type, null: true,
|
|
|
|
resolver: Resolvers::AuthoredMergeRequestsResolver,
|
|
|
|
description: 'Merge Requests authored by the user'
|
|
|
|
field :assigned_merge_requests, Types::MergeRequestType.connection_type, null: true,
|
|
|
|
resolver: Resolvers::AssignedMergeRequestsResolver,
|
|
|
|
description: 'Merge Requests assigned to the user'
|
2020-01-01 13:55:28 +05:30
|
|
|
|
|
|
|
field :snippets,
|
|
|
|
Types::SnippetType.connection_type,
|
|
|
|
null: true,
|
|
|
|
description: 'Snippets authored by the user',
|
|
|
|
resolver: Resolvers::Users::SnippetsResolver
|
2019-02-15 15:39:39 +05:30
|
|
|
end
|
|
|
|
end
|