Aggiunge i tornei con hub, pagina pubblica e tabellone per semifinali e finali.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-05 15:05:57 +02:00
co-authored by Cursor
parent d52434fb2e
commit a1f4c24a43
124 changed files with 6979 additions and 91 deletions
@@ -0,0 +1,34 @@
module Tournaments
class ScheduleMatch
def self.call(tournament:, attrs:)
new(tournament: tournament, attrs: attrs).call
end
def initialize(tournament:, attrs:)
@tournament = tournament
@attrs = attrs.to_h.symbolize_keys
end
def call
Tournaments::Entitlements.new(@tournament.club).assert_writable!
raise Tournaments::EntitlementError.new("Torneo archiviato", code: "archived") unless @tournament.writable?
team = Tournaments::EnsureBroadcastTeam.call(@tournament)
match = team.matches.build(
tournament: @tournament,
sport_key: @tournament.sport_key,
home_participant_id: @attrs[:home_participant_id].presence,
away_participant_id: @attrs[:away_participant_id].presence,
tournament_group_id: @attrs[:tournament_group_id].presence,
tournament_round_id: @attrs[:tournament_round_id].presence,
court: @attrs[:court].presence,
location: @attrs[:location].presence,
scheduled_at: @attrs[:scheduled_at],
opponent_name: "TBD",
sets_to_win: @attrs[:sets_to_win].presence || 3
)
match.save!
match
end
end
end