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

module Types
  class ProjectInvitationType < BaseObject
    graphql_name 'ProjectInvitation'
    description 'Represents a Project Membership Invitation'

    expose_permissions Types::PermissionTypes::Project

    implements InvitationInterface

    authorize :read_project

    field :project, Types::ProjectType, null: true,
          description: 'Project ID for the project of the invitation'

    def project
      Gitlab::Graphql::Loaders::BatchModelLoader.new(Project, object.source_id).find
    end
  end
end