2020-06-15 14:08:43 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Resolvers
|
|
|
|
class ProjectPipelineResolver < BaseResolver
|
2020-11-09 19:08:52 -05:00
|
|
|
type ::Types::Ci::PipelineType, null: true
|
|
|
|
|
2020-06-15 14:08:43 -04:00
|
|
|
alias_method :project, :object
|
|
|
|
|
|
|
|
argument :iid, GraphQL::ID_TYPE,
|
|
|
|
required: true,
|
2021-01-11 19:10:42 -05:00
|
|
|
description: 'IID of the Pipeline, e.g., "1".'
|
2020-06-15 14:08:43 -04:00
|
|
|
|
|
|
|
def resolve(iid:)
|
|
|
|
BatchLoader::GraphQL.for(iid).batch(key: project) do |iids, loader, args|
|
2020-11-30 07:09:21 -05:00
|
|
|
finder = ::Ci::PipelinesFinder.new(project, context[:current_user], iids: iids)
|
|
|
|
|
|
|
|
finder.execute.each { |pipeline| loader.call(pipeline.iid.to_s, pipeline) }
|
2020-06-15 14:08:43 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|