diff options
Diffstat (limited to 'lib/bulk_imports/importers/group_importer.rb')
-rw-r--r-- | lib/bulk_imports/importers/group_importer.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/bulk_imports/importers/group_importer.rb b/lib/bulk_imports/importers/group_importer.rb new file mode 100644 index 00000000000..c7253590c87 --- /dev/null +++ b/lib/bulk_imports/importers/group_importer.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module BulkImports + module Importers + class GroupImporter + def initialize(entity) + @entity = entity + end + + def execute + entity.start! + bulk_import = entity.bulk_import + configuration = bulk_import.configuration + + context = BulkImports::Pipeline::Context.new( + current_user: bulk_import.user, + entity: entity, + configuration: configuration + ) + + BulkImports::Groups::Pipelines::GroupPipeline.new.run(context) + BulkImports::Groups::Pipelines::SubgroupEntitiesPipeline.new.run(context) + + entity.finish! + end + + private + + attr_reader :entity + end + end +end |