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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bulk_imports/projects/transformers/project_attributes_transformer.rb')
-rw-r--r--lib/bulk_imports/projects/transformers/project_attributes_transformer.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/bulk_imports/projects/transformers/project_attributes_transformer.rb b/lib/bulk_imports/projects/transformers/project_attributes_transformer.rb
new file mode 100644
index 00000000000..24c55d8dbb1
--- /dev/null
+++ b/lib/bulk_imports/projects/transformers/project_attributes_transformer.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+module BulkImports
+ module Projects
+ module Transformers
+ class ProjectAttributesTransformer
+ PROJECT_IMPORT_TYPE = 'gitlab_project_migration'
+
+ def transform(context, data)
+ entity = context.entity
+ visibility = data.delete('visibility')
+
+ data['name'] = entity.destination_name
+ data['path'] = entity.destination_name.parameterize
+ data['import_type'] = PROJECT_IMPORT_TYPE
+ data['visibility_level'] = Gitlab::VisibilityLevel.string_options[visibility] if visibility.present?
+ data['namespace_id'] = Namespace.find_by_full_path(entity.destination_namespace)&.id if entity.destination_namespace.present?
+
+ data.transform_keys!(&:to_sym)
+ end
+ end
+ end
+ end
+end