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

issue_status_counts_type.rb « types « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f2b1ba8e655f56f13e6efd759f80e22dcb78624e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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