blob: 278bd463dcd9d12fce6ccf33dd03b2651499253f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# 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
|