diff --git a/app/jobs/enqueue_background_job.rb b/app/jobs/enqueue_background_job.rb index 6dc26b58..aa5cdccf 100644 --- a/app/jobs/enqueue_background_job.rb +++ b/app/jobs/enqueue_background_job.rb @@ -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 diff --git a/app/jobs/import_google_takeout_job.rb b/app/jobs/import/google_takeout_job.rb similarity index 84% rename from app/jobs/import_google_takeout_job.rb rename to app/jobs/import/google_takeout_job.rb index 6a3faf60..d962a304 100644 --- a/app/jobs/import_google_takeout_job.rb +++ b/app/jobs/import/google_takeout_job.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ImportGoogleTakeoutJob < ApplicationJob +class Import::GoogleTakeoutJob < ApplicationJob queue_as :imports sidekiq_options retry: false diff --git a/app/jobs/import_immich_geodata_job.rb b/app/jobs/import/immich_geodata_job.rb similarity index 76% rename from app/jobs/import_immich_geodata_job.rb rename to app/jobs/import/immich_geodata_job.rb index d4b63b45..c9329f05 100644 --- a/app/jobs/import_immich_geodata_job.rb +++ b/app/jobs/import/immich_geodata_job.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ImportImmichGeodataJob < ApplicationJob +class Import::ImmichGeodataJob < ApplicationJob queue_as :imports def perform(user_id) diff --git a/app/services/tasks/imports/google_records.rb b/app/services/tasks/imports/google_records.rb index f130180b..8f8839e3 100644 --- a/app/services/tasks/imports/google_records.rb +++ b/app/services/tasks/imports/google_records.rb @@ -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 diff --git a/spec/jobs/import_immich_geodata_job_spec.rb b/spec/jobs/import/immich_geodata_job_spec.rb similarity index 69% rename from spec/jobs/import_immich_geodata_job_spec.rb rename to spec/jobs/import/immich_geodata_job_spec.rb index 54eb09e5..d78f3cd8 100644 --- a/spec/jobs/import_immich_geodata_job_spec.rb +++ b/spec/jobs/import/immich_geodata_job_spec.rb @@ -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 diff --git a/spec/services/tasks/imports/google_records_spec.rb b/spec/services/tasks/imports/google_records_spec.rb index f160da0f..0310dbd1 100644 --- a/spec/services/tasks/imports/google_records_spec.rb +++ b/spec/services/tasks/imports/google_records_spec.rb @@ -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