summaryrefslogtreecommitdiff
path: root/app/graphql/types/group_type.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/types/group_type.rb')
-rw-r--r--app/graphql/types/group_type.rb25
1 files changed, 18 insertions, 7 deletions
diff --git a/app/graphql/types/group_type.rb b/app/graphql/types/group_type.rb
index fb028184488..0ee8a19c1a3 100644
--- a/app/graphql/types/group_type.rb
+++ b/app/graphql/types/group_type.rb
@@ -12,10 +12,7 @@ module Types
description: 'Web URL of the group'
field :avatar_url, GraphQL::STRING_TYPE, null: true,
- description: 'Avatar URL of the group',
- resolve: -> (group, args, ctx) do
- group.avatar_url(only_path: false)
- end
+ description: 'Avatar URL of the group'
field :custom_emoji, Types::CustomEmojiType.connection_type, null: true,
description: 'Custom emoji within this namespace',
@@ -44,8 +41,7 @@ module Types
description: 'Indicates if a group is disabled from getting mentioned'
field :parent, GroupType, null: true,
- description: 'Parent group',
- resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Group, obj.parent_id).find }
+ description: 'Parent group'
field :issues,
Types::IssueType.connection_type,
@@ -92,10 +88,13 @@ module Types
field :container_repositories,
Types::ContainerRepositoryType.connection_type,
null: true,
- description: 'Container repositories of the project',
+ description: 'Container repositories of the group',
resolver: Resolvers::ContainerRepositoriesResolver,
authorize: :read_container_image
+ field :container_repositories_count, GraphQL::INT_TYPE, null: false,
+ description: 'Number of container repositories in the group'
+
def label(title:)
BatchLoader::GraphQL.for(title).batch(key: group) do |titles, loader, args|
LabelsFinder
@@ -120,6 +119,18 @@ module Types
.execute
end
+ def avatar_url
+ object.avatar_url(only_path: false)
+ end
+
+ def parent
+ Gitlab::Graphql::Loaders::BatchModelLoader.new(Group, object.parent_id).find
+ end
+
+ def container_repositories_count
+ group.container_repositories.size
+ end
+
private
def group