mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 17:51:39 -05:00
Move import jobs to the Import namespace
This commit is contained in:
parent
dde76fd41f
commit
6566455a2f
6 changed files with 8 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ImportGoogleTakeoutJob < ApplicationJob
|
||||
class Import::GoogleTakeoutJob < ApplicationJob
|
||||
queue_as :imports
|
||||
sidekiq_options retry: false
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ImportImmichGeodataJob < ApplicationJob
|
||||
class Import::ImmichGeodataJob < ApplicationJob
|
||||
queue_as :imports
|
||||
|
||||
def perform(user_id)
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue