From 9f9efc2bc07810d2e06b37bad94e5922681eadef Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 18 Feb 2026 22:38:15 +0900 Subject: feat: refactor tournament to generic DB-backed N-person bracket Replace hardcoded 6-person tournament with a generic single-elimination bracket system backed by new DB tables (tournaments, tournament_entries, tournament_matches). Includes admin CRUD, standard seeding algorithm, bye handling, and a CSS Grid bracket renderer on the frontend. Add comprehensive tests for backend API/admin handlers, seeding logic, and frontend bracket component. Co-Authored-By: Claude Opus 4.6 --- backend/fixtures/dev.sql | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'backend/fixtures/dev.sql') diff --git a/backend/fixtures/dev.sql b/backend/fixtures/dev.sql index bc25011..2876456 100644 --- a/backend/fixtures/dev.sql +++ b/backend/fixtures/dev.sql @@ -44,3 +44,25 @@ VALUES (5, '', '42'), (6, '', '42'), (7, '', '42'); + +-- Tournament: 3 participants, bracket_size=4, num_rounds=2 +INSERT INTO tournaments +(display_name, bracket_size, num_rounds) +VALUES + ('TEST Tournament', 4, 2); + +-- Entries: 3 players with seeds 1-3 (seed 4 = bye) +INSERT INTO tournament_entries +(tournament_id, user_id, seed) +VALUES + (1, 1, 1), + (1, 2, 2), + (1, 3, 3); + +-- Matches: Round 0 has 2 matches, Round 1 has 1 match (final) +INSERT INTO tournament_matches +(tournament_id, round, position, game_id) +VALUES + (1, 0, 0, 1), + (1, 0, 1, 2), + (1, 1, 0, 3); -- cgit v1.3.1