mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-12 20:24:43 +08:00
16 lines
504 B
Ruby
16 lines
504 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
module MyModules
|
||
|
class CopyContentJob < ApplicationJob
|
||
|
def perform(user, source_my_module_id, target_my_module_id)
|
||
|
MyModule.transaction do
|
||
|
target_my_module = MyModule.find(target_my_module_id)
|
||
|
MyModule.find(source_my_module_id).copy_content(user, target_my_module)
|
||
|
target_my_module.update!(provisioning_status: :done)
|
||
|
end
|
||
|
rescue StandardError => _e
|
||
|
target_my_module.update(provisioning_status: :failed)
|
||
|
end
|
||
|
end
|
||
|
end
|