diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-08 12:12:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-08 12:12:15 +0300 |
commit | 5bd8b9d24f16a0b9773c55cd0680ed98d345b07c (patch) | |
tree | 14f131de11550de67ef8a38c369b4362245272b2 /app/services/import | |
parent | 5bc16a3b1a97fc22d34be1b23cb2fc9050a9bd06 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/import')
-rw-r--r-- | app/services/import/prepare_service.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/app/services/import/prepare_service.rb b/app/services/import/prepare_service.rb new file mode 100644 index 00000000000..278bd463dcd --- /dev/null +++ b/app/services/import/prepare_service.rb @@ -0,0 +1,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 |