debian-mirror-gitlab/app/services/import/prepare_service.rb

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

32 lines
629 B
Ruby
Raw Normal View History

2022-08-27 11:52:29 +05:30
# frozen_string_literal: true
module Import
class PrepareService < ::BaseService
def execute
uploader = UploadService.new(project, params[:file]).execute
if uploader
enqueue_import(uploader.upload)
ServiceResponse.success(message: success_message)
else
ServiceResponse.error(message: _('File upload error.'))
end
end
private
def enqueue_import(upload)
worker.perform_async(current_user.id, project.id, upload.id)
end
def worker
raise NotImplementedError
end
def success_message
raise NotImplementedError
end
end
end