gitlab-org--gitlab-foss/app/graphql/resolvers/concerns/resolves_pipelines.rb
Brett Walker 1285b00517 Added common fields to the IssueType
and allow passing of child_complexity to the
'resolver_complexity' metho
2019-05-31 13:19:29 -05:00

35 lines
974 B
Ruby

# frozen_string_literal: true
module ResolvesPipelines
extend ActiveSupport::Concern
included do
type [Types::Ci::PipelineType], null: false
argument :status,
Types::Ci::PipelineStatusEnum,
required: false,
description: "Filter pipelines by their status"
argument :ref,
GraphQL::STRING_TYPE,
required: false,
description: "Filter pipelines by the ref they are run for"
argument :sha,
GraphQL::STRING_TYPE,
required: false,
description: "Filter pipelines by the sha of the commit they are run for"
end
class_methods do
def resolver_complexity(args, child_complexity:)
complexity = super
complexity += 2 if args[:sha]
complexity += 2 if args[:ref]
complexity
end
end
def resolve_pipelines(project, params = {})
PipelinesFinder.new(project, context[:current_user], params).execute
end
end