2022-12-10 04:21:37 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-01-05 20:54:00 +01:00
|
|
|
class ExportWorker
|
|
|
|
include Sidekiq::Worker
|
|
|
|
|
2021-12-22 00:25:32 +01:00
|
|
|
sidekiq_options queue: :export, retry: 0
|
2016-01-05 20:54:00 +01:00
|
|
|
|
|
|
|
# @param user_id [Integer] the user id
|
|
|
|
def perform(user_id)
|
2022-12-10 04:21:37 +01:00
|
|
|
user = User.find(user_id)
|
|
|
|
|
|
|
|
exporter = Exporter.new(user)
|
2016-01-05 20:54:00 +01:00
|
|
|
exporter.export
|
2022-12-10 04:21:37 +01:00
|
|
|
|
|
|
|
Notification::DataExported.create(
|
|
|
|
target_id: user.id,
|
|
|
|
target_type: "User::DataExport",
|
|
|
|
recipient: user,
|
|
|
|
new: true
|
|
|
|
)
|
2016-01-05 20:54:00 +01:00
|
|
|
end
|
|
|
|
end
|