diff options
Diffstat (limited to 'app/graphql/types/ci/pipeline_counts_type.rb')
-rw-r--r-- | app/graphql/types/ci/pipeline_counts_type.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/graphql/types/ci/pipeline_counts_type.rb b/app/graphql/types/ci/pipeline_counts_type.rb new file mode 100644 index 00000000000..9c2b822091e --- /dev/null +++ b/app/graphql/types/ci/pipeline_counts_type.rb @@ -0,0 +1,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 |