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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessio Caiazza <acaiazza@gitlab.com>2019-05-13 00:10:46 +0300
committerAlessio Caiazza <acaiazza@gitlab.com>2019-06-03 13:01:32 +0300
commit83a8b779615c968af5afe15a1cbc6903d639f265 (patch)
treefb98c67d6e184ff2b283ad26b82fc9d3316191a4 /lib/gitlab/graphql
parentac03f30cd938cd2c75d05cbc7adbde3f42666ab1 (diff)
Add Namespace and ProjectStatistics to GraphQL API
We can query namespaces, and nested projects. Projects now exposes statistics
Diffstat (limited to 'lib/gitlab/graphql')
-rw-r--r--lib/gitlab/graphql/loaders/batch_project_statistics_loader.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/gitlab/graphql/loaders/batch_project_statistics_loader.rb b/lib/gitlab/graphql/loaders/batch_project_statistics_loader.rb
new file mode 100644
index 00000000000..5e151f4dbd7
--- /dev/null
+++ b/lib/gitlab/graphql/loaders/batch_project_statistics_loader.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Graphql
+ module Loaders
+ class BatchProjectStatisticsLoader
+ attr_reader :project_id
+
+ def initialize(project_id)
+ @project_id = project_id
+ end
+
+ def find
+ BatchLoader.for(project_id).batch do |project_ids, loader|
+ ProjectStatistics.for_project_ids(project_ids).each do |statistics|
+ loader.call(statistics.project_id, statistics)
+ end
+ end
+ end
+ end
+ end
+ end
+end