Sha256: afb67a04a6c9b4c9a20cf3f571bdeeb1354a687390d02363f5a5ad7cbc8f8327
Contents?: true
Size: 1.08 KB
Versions: 19
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true require "csv" module Decidim module Votings module Census module Admin # A command with the business logic to destroy a census dataset # from the admin panel. class DestroyDataset < Rectify::Command def initialize(dataset, current_user) @dataset = dataset @current_user = current_user end # Executes the command. Broadcast this events: # - :ok when everything is valid # - :invalid when the form wasn't valid and couldn't proceed- # # Returns nothing. def call return broadcast(:invalid) unless dataset || current_user destroy_census_dataset! broadcast(:ok) end attr_reader :dataset, :current_user def destroy_census_dataset! Decidim.traceability.perform_action!( :delete, dataset, current_user ) do dataset.destroy! end end end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems