debian-mirror-gitlab/app/graphql/resolvers/project_pipeline_resolver.rb

22 lines
608 B
Ruby
Raw Normal View History

2020-06-23 00:09:42 +05:30
# frozen_string_literal: true
module Resolvers
class ProjectPipelineResolver < BaseResolver
2021-01-29 00:20:46 +05:30
type ::Types::Ci::PipelineType, null: true
2020-06-23 00:09:42 +05:30
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|
2021-02-22 17:27:13 +05:30
finder = ::Ci::PipelinesFinder.new(project, context[:current_user], iids: iids)
finder.execute.each { |pipeline| loader.call(pipeline.iid.to_s, pipeline) }
2020-06-23 00:09:42 +05:30
end
end
end
end