2020-06-15 14:08:43 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Resolvers
|
|
|
|
class ProjectPipelineResolver < BaseResolver
|
|
|
|
alias_method :project, :object
|
|
|
|
|
|
|
|
argument :iid, GraphQL::ID_TYPE,
|
|
|
|
required: true,
|
|
|
|
description: 'IID of the Pipeline, e.g., "1"'
|
|
|
|
|
|
|
|
def resolve(iid:)
|
|
|
|
BatchLoader::GraphQL.for(iid).batch(key: project) do |iids, loader, args|
|
2020-08-18 05:10:05 -04:00
|
|
|
args[:key].all_pipelines.for_iid(iids).each { |pl| loader.call(pl.iid.to_s, pl) }
|
2020-06-15 14:08:43 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|