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

project_entities_pipeline.rb « pipelines « groups « bulk_imports « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6f8e2e2d8d9d872e8bbaa8dca453f0172d8e8b1d (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
26
27
28
29
30
# frozen_string_literal: true

module BulkImports
  module Groups
    module Pipelines
      class ProjectEntitiesPipeline
        include Pipeline
        include HexdigestCacheStrategy

        extractor Common::Extractors::GraphqlExtractor, query: Graphql::GetProjectsQuery
        transformer Common::Transformers::ProhibitedAttributesTransformer

        def transform(context, data)
          {
            source_type: :project_entity,
            source_full_path: data['full_path'],
            destination_name: data['path'],
            destination_namespace: context.entity.group.full_path,
            parent_id: context.entity.id,
            source_xid: GlobalID.parse(data['id']).model_id
          }
        end

        def load(context, data)
          context.bulk_import.entities.create!(data)
        end
      end
    end
  end
end