Sha256: c868a54b2548a99326a894d9691a7462451a7c33a85d13600625bdf314613cae

Contents?: true

Size: 345 Bytes

Versions: 14

Compression:

Stored size: 345 Bytes

Contents

module Importo
  class PurgeImportJob < ApplicationJob
    def perform(owner, months)
      imports = Import.where(importo_ownable: owner, created_at: ..months.months.ago.beginning_of_day)

      imports.each do |import|
        import.original.purge
        import.result.purge
      end

      imports.in_batches.destroy_all
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
importo-3.0.21 app/jobs/importo/purge_import_job.rb
importo-3.0.20 app/jobs/importo/purge_import_job.rb
importo-3.0.19 app/jobs/importo/purge_import_job.rb
importo-3.0.18 app/jobs/importo/purge_import_job.rb
importo-3.0.17 app/jobs/importo/purge_import_job.rb
importo-3.0.16 app/jobs/importo/purge_import_job.rb
importo-3.0.15 app/jobs/importo/purge_import_job.rb
importo-3.0.14 app/jobs/importo/purge_import_job.rb
importo-3.0.13 app/jobs/importo/purge_import_job.rb
importo-3.0.12 app/jobs/importo/purge_import_job.rb
importo-3.0.11 app/jobs/importo/purge_import_job.rb
importo-3.0.10 app/jobs/importo/purge_import_job.rb
importo-3.0.9 app/jobs/importo/purge_import_job.rb
importo-2.0.5 app/jobs/importo/purge_import_job.rb