Sha256: d0d9a6b5ca3229f764ea0dbb358e6d7d3c001b5031d9038e1baa4be5b8eb951b

Contents?: true

Size: 796 Bytes

Versions: 21

Compression:

Stored size: 796 Bytes

Contents

# frozen_string_literal: true

module Decidim
  class DataPortabilityExportJob < ApplicationJob
    queue_as :default

    def perform(user, format)
      objects = Decidim::DataPortabilitySerializers.data_entities
      export_data = []
      export_images = []

      objects.each do |object|
        klass = Object.const_get(object)
        export_data << [klass.model_name.name.parameterize.pluralize, Decidim::Exporters.find_exporter(format).new(klass.user_collection(user), klass.export_serializer).export]
        export_images << [klass.model_name.name.parameterize.pluralize, klass.data_portability_images(user).flatten] unless klass.data_portability_images(user).nil?
      end

      ExportMailer.data_portability_export(user, export_data, export_images).deliver_now
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
decidim-core-0.20.1 app/jobs/decidim/data_portability_export_job.rb
decidim-core-0.20.0 app/jobs/decidim/data_portability_export_job.rb
decidim-core-0.19.1 app/jobs/decidim/data_portability_export_job.rb
decidim-core-0.18.1 app/jobs/decidim/data_portability_export_job.rb
decidim-core-0.19.0 app/jobs/decidim/data_portability_export_job.rb
decidim-core-0.17.2 app/jobs/decidim/data_portability_export_job.rb
decidim-core-0.18.0 app/jobs/decidim/data_portability_export_job.rb
decidim-core-0.17.1 app/jobs/decidim/data_portability_export_job.rb
decidim-core-0.16.1 app/jobs/decidim/data_portability_export_job.rb
decidim-core-0.17.0 app/jobs/decidim/data_portability_export_job.rb
decidim-core-0.16.0 app/jobs/decidim/data_portability_export_job.rb
decidim-core-0.15.2 app/jobs/decidim/data_portability_export_job.rb
decidim-core-0.15.1 app/jobs/decidim/data_portability_export_job.rb
decidim-core-0.15.0 app/jobs/decidim/data_portability_export_job.rb
decidim-core-0.14.4 app/jobs/decidim/data_portability_export_job.rb
decidim-core-0.14.3 app/jobs/decidim/data_portability_export_job.rb
decidim-core-0.14.2 app/jobs/decidim/data_portability_export_job.rb
decidim-core-0.14.1 app/jobs/decidim/data_portability_export_job.rb
decidim-core-0.13.1 app/jobs/decidim/data_portability_export_job.rb
decidim-core-0.13.0 app/jobs/decidim/data_portability_export_job.rb