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

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

module Resolvers
  module Ci
    class PipelineJobArtifactsResolver < BaseResolver
      type [Types::Ci::JobArtifactType], null: false

      alias_method :pipeline, :object

      def resolve
        find_job_artifacts
      end

      private

      def find_job_artifacts
        BatchLoader::GraphQL.for(pipeline).batch do |pipelines, loader|
          ActiveRecord::Associations::Preloader.new.preload(pipelines, :job_artifacts) # rubocop: disable CodeReuse/ActiveRecord

          pipelines.each { |pl| loader.call(pl, pl.job_artifacts) }
        end
      end
    end
  end
end