Welcome to mirror list, hosted at ThFree Co, Russian Federation.

project_pipeline_resolver.rb « resolvers « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b604a408928d59c2cc18d1dc8abc38f6d4cefb75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

module Resolvers
  class ProjectPipelineResolver < BaseResolver
    type ::Types::Ci::PipelineType, null: true

    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|
        finder = ::Ci::PipelinesFinder.new(project, context[:current_user], iids: iids)

        finder.execute.each { |pipeline| loader.call(pipeline.iid.to_s, pipeline) }
      end
    end
  end
end