debian-mirror-gitlab/app/services/bulk_imports/export_service.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
620 B
Ruby
Raw Normal View History

2021-06-08 01:23:25 +05:30
# frozen_string_literal: true
module BulkImports
class ExportService
def initialize(portable:, user:)
@portable = portable
@current_user = user
end
def execute
FileTransfer.config_for(portable).portable_relations.each do |relation|
RelationExportWorker.perform_async(current_user.id, portable.id, portable.class.name, relation)
end
ServiceResponse.success
rescue StandardError => e
ServiceResponse.error(
message: e.class,
http_status: :unprocessable_entity
)
end
private
attr_reader :portable, :current_user
end
end