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:
Diffstat (limited to 'app/graphql/types/issue_status_counts_type.rb')
-rw-r--r--app/graphql/types/issue_status_counts_type.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/graphql/types/issue_status_counts_type.rb b/app/graphql/types/issue_status_counts_type.rb
new file mode 100644
index 00000000000..f2b1ba8e655
--- /dev/null
+++ b/app/graphql/types/issue_status_counts_type.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+module Types
+ class IssueStatusCountsType < BaseObject
+ graphql_name 'IssueStatusCountsType'
+ description "Represents total number of issues for the represented statuses."
+
+ authorize :read_issue
+
+ def self.available_issue_states
+ @available_issue_states ||= Issue.available_states.keys.push('all')
+ end
+
+ ::Gitlab::IssuablesCountForState::STATES.each do |state|
+ next unless available_issue_states.include?(state.downcase)
+
+ field state,
+ GraphQL::INT_TYPE,
+ null: true,
+ description: "Number of issues with status #{state.upcase} for the project"
+ end
+ end
+end