# frozen_string_literal: true module EuchreCamp module Actions module Admin module Tournaments class Destroy < EuchreCamp::Action include Deps[repo: 'repositories.events'] def handle(request, response) tournament_id = request.params[:id] repo.delete(tournament_id) response.flash[:message] = "Tournament deleted" response.redirect_to("/admin/tournaments") rescue StandardError => e response.flash[:error] = "Failed to delete: #{e.message}" response.redirect_to("/admin/tournaments") end end end end end end