Welcome to mirror list, hosted at ThFree Co, Russian Federation.

project_member_type.rb « types « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e9ccb51886b9f3659ea81569d52e0ea1132c8302 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

module Types
  class ProjectMemberType < BaseObject
    graphql_name 'ProjectMember'
    description 'Represents a Project Member'

    expose_permissions Types::PermissionTypes::Project

    implements MemberInterface

    authorize :read_project

    field :id, GraphQL::ID_TYPE, null: false,
          description: 'ID of the member'

    field :user, Types::UserType, null: false,
          description: 'User that is associated with the member object',
          resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(User, obj.user_id).find }

    field :project, Types::ProjectType, null: true,
          description: 'Project that User is a member of',
          resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Project, obj.source_id).find }
  end
end