summaryrefslogtreecommitdiff
path: root/app/graphql/types/project_invitation_type.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/types/project_invitation_type.rb')
-rw-r--r--app/graphql/types/project_invitation_type.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/graphql/types/project_invitation_type.rb b/app/graphql/types/project_invitation_type.rb
new file mode 100644
index 00000000000..a5367a4f204
--- /dev/null
+++ b/app/graphql/types/project_invitation_type.rb
@@ -0,0 +1,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