Sha256: 21b5b7ee2248f368bec40236e0a9acf38af35a1d888cc69b333d9d8b7f8c30cd

Contents?: true

Size: 591 Bytes

Versions: 25

Compression:

Stored size: 591 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    class CreateImport < Rectify::Command
      def initialize(form)
        @form = form
      end

      def call
        return broadcast(:invalid) if form.invalid?

        imported_data = form.importer.prepare
        transaction do
          form.importer.import!

          return broadcast(:ok, imported_data)
        rescue StandardError
          raise ActiveRecord::Rollback
        end

        # Something went wrong with import/finish
        broadcast(:invalid)
      end

      attr_reader :form
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
decidim-admin-0.26.10 app/commands/decidim/admin/create_import.rb
decidim-admin-0.26.9 app/commands/decidim/admin/create_import.rb
decidim-admin-0.26.8 app/commands/decidim/admin/create_import.rb
decidim-admin-0.26.7 app/commands/decidim/admin/create_import.rb
decidim-admin-0.26.5 app/commands/decidim/admin/create_import.rb
decidim-admin-0.26.4 app/commands/decidim/admin/create_import.rb
decidim-admin-0.26.3 app/commands/decidim/admin/create_import.rb
decidim-admin-0.26.2 app/commands/decidim/admin/create_import.rb
decidim-admin-0.26.1 app/commands/decidim/admin/create_import.rb
decidim-admin-0.26.0 app/commands/decidim/admin/create_import.rb
decidim-admin-0.26.0.rc2 app/commands/decidim/admin/create_import.rb
decidim-admin-0.26.0.rc1 app/commands/decidim/admin/create_import.rb
decidim-admin-0.25.2 app/commands/decidim/admin/create_import.rb
decidim-admin-0.25.1 app/commands/decidim/admin/create_import.rb
decidim-admin-0.25.0 app/commands/decidim/admin/create_import.rb
decidim-admin-0.25.0.rc4 app/commands/decidim/admin/create_import.rb
decidim-admin-0.25.0.rc3 app/commands/decidim/admin/create_import.rb
decidim-admin-0.25.0.rc2 app/commands/decidim/admin/create_import.rb
decidim-admin-0.25.0.rc1 app/commands/decidim/admin/create_import.rb
decidim-admin-0.24.3 app/commands/decidim/admin/create_import.rb