Move import jobs to the Import namespace

This commit is contained in:
Eugene Burmakin 2024-10-03 14:04:37 +02:00
parent dde76fd41f
commit 6566455a2f
6 changed files with 8 additions and 8 deletions

View file

@ -6,7 +6,7 @@ class EnqueueBackgroundJob < ApplicationJob
def perform(job_name, user_id)
case job_name
when 'start_immich_import'
ImportImmichGeodataJob.perform_later(user_id)
Import::ImmichGeodataJob.perform_later(user_id)
when 'start_reverse_geocoding', 'continue_reverse_geocoding'
Jobs::Create.new(job_name, user_id).call
else

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class ImportGoogleTakeoutJob < ApplicationJob
class Import::GoogleTakeoutJob < ApplicationJob
queue_as :imports
sidekiq_options retry: false

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
class ImportImmichGeodataJob < ApplicationJob
class Import::ImmichGeodataJob < ApplicationJob
queue_as :imports
def perform(user_id)

View file

@ -32,7 +32,7 @@ class Tasks::Imports::GoogleRecords
def schedule_import_jobs(json_data, import_id)
json_data['locations'].each do |json|
ImportGoogleTakeoutJob.perform_later(import_id, json.to_json)
Import::GoogleTakeoutJob.perform_later(import_id, json.to_json)
end
end

View file

@ -2,14 +2,14 @@
require 'rails_helper'
RSpec.describe ImportImmichGeodataJob, type: :job do
RSpec.describe Import::ImmichGeodataJob, type: :job do
describe '#perform' do
let(:user) { create(:user) }
it 'calls Immich::ImportGeodata' do
expect_any_instance_of(Immich::ImportGeodata).to receive(:call)
ImportImmichGeodataJob.perform_now(user.id)
Import::ImmichGeodataJob.perform_now(user.id)
end
end
end

View file

@ -7,8 +7,8 @@ RSpec.describe Tasks::Imports::GoogleRecords do
let(:user) { create(:user) }
let(:file_path) { Rails.root.join('spec/fixtures/files/google/records.json') }
it 'schedules the ImportGoogleTakeoutJob' do
expect(ImportGoogleTakeoutJob).to receive(:perform_later).exactly(3).times
it 'schedules the Import::GoogleTakeoutJob' do
expect(Import::GoogleTakeoutJob).to receive(:perform_later).exactly(3).times
described_class.new(file_path, user.email).call
end