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: e4a0782e3cf6b5c8cedf3d527d4d34ae0772e829 (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::Types::Int,
            null: true,
            description: "Number of issues with status #{state.upcase} for the project"
    end
  end
end