summaryrefslogtreecommitdiff
path: root/app/workers/project_export_worker.rb
blob: c3d84bb0b93bf18bc6865d4024163ca6aa6189c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class ProjectExportWorker
  include ApplicationWorker
  include ExceptionBacktrace

  sidekiq_options retry: 3

  def perform(current_user_id, project_id, after_export_strategy = {}, params = {})
    current_user = User.find(current_user_id)
    project = Project.find(project_id)
    after_export = build!(after_export_strategy)

    ::Projects::ImportExport::ExportService.new(project, current_user, params).execute(after_export)
  end

  private

  def build!(after_export_strategy)
    strategy_klass = after_export_strategy&.delete('klass')

    Gitlab::ImportExport::AfterExportStrategyBuilder.build!(strategy_klass, after_export_strategy)
  end
end