# frozen_string_literal: true module EuchreCamp module Actions module Admin module Tournaments module Participants class Destroy < EuchreCamp::Action include Deps[participants_repo: 'repositories.event_participants'] def handle(request, response) tournament_id = request.params[:id] player_id = request.params[:player_id] participants_repo.remove_player(tournament_id, player_id.to_i) response.flash[:message] = "Player removed from tournament" response.redirect_to("/admin/tournaments/#{tournament_id}") rescue StandardError => e response.flash[:error] = "Failed to remove player: #{e.message}" response.redirect_to("/admin/tournaments/#{tournament_id}") end end end end end end end