Sha256: 29cdc0a216807b45ed446eee9232639736c61471fb614df91ecdee789a596d61
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true module Decidim module ComparativeStats module Admin # A command with all the business logic when destroying an endpoint class DestroyEndpoint < Rectify::Command # Public: Initializes the command. # # form - A form object with the params. def initialize(endpoint, current_user) @endpoint = endpoint @current_user = current_user end # Executes the command. Broadcasts these events: # # - :ok when everything is valid. # - :invalid if the form wasn't valid and we couldn't proceed. # # Returns nothing. def call destroy_endpoint! broadcast(:ok) end private attr_reader :endpoint, :current_user def destroy_endpoint! Decidim.traceability.perform_action!( :delete, endpoint, current_user ) do endpoint.destroy! end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems