summaryrefslogtreecommitdiff
path: root/app/graphql/types/ci/pipeline_counts_type.rb
blob: 9c2b822091eb78c933d4250b704b31d91b98fec0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

module Types
  module Ci
    class PipelineCountsType < BaseObject
      graphql_name 'PipelineCounts'
      description "Represents pipeline counts for the project"

      authorize :read_pipeline

      (::Types::Ci::PipelineScopeEnum.values.keys - %w[BRANCHES TAGS]).each do |scope|
        field scope.downcase,
              GraphQL::Types::Int,
              null: true,
              description: "Number of pipelines with scope #{scope} for the project"
      end

      field :all,
            GraphQL::Types::Int,
            null: true,
            description: 'Total number of pipelines for the project.'
    end
  end
end