feat(tournament): implement multi-stage tournament support with intermediate and final stages

- Added backend controller for tournament stages with endpoints to get, upsert, and advance stages.
- Created database migration for new tables: tournament_stage and tournament_stage_advancement.
- Updated models for TournamentStage and TournamentStageAdvancement.
- Enhanced frontend components to manage tournament stages, including configuration for intermediate and final rounds.
- Implemented logic for saving and advancing tournament stages, including handling of pool rules and third place matches.
- Added error handling and loading states in the frontend for better user experience.
This commit is contained in:
Torsten Schulz (local)
2025-12-14 06:46:00 +01:00
parent e83bc250a8
commit 945ec0d48c
23 changed files with 1688 additions and 50 deletions

View File

@@ -39,6 +39,11 @@ import {
updatePairing,
deletePairing,
} from '../controllers/tournamentController.js';
import {
getStages,
upsertStages,
advanceStage,
} from '../controllers/tournamentStagesController.js';
import { authenticate } from '../middleware/authMiddleware.js';
const router = express.Router();
@@ -66,9 +71,6 @@ router.post('/groups/manual', authenticate, manualAssignGroups);
router.put('/participant/group', authenticate, assignParticipantToGroup); // Muss VOR /:clubId/:tournamentId stehen!
router.put('/:clubId/:tournamentId', authenticate, updateTournament);
router.get('/:clubId/:tournamentId', authenticate, getTournament);
router.get('/:clubId', authenticate, getTournaments);
router.post('/', authenticate, addTournament);
// Externe Teilnehmer
router.post('/external-participant', authenticate, addExternalParticipant);
router.post('/external-participants', authenticate, getExternalParticipants);
@@ -88,4 +90,13 @@ router.post('/pairing/:clubId/:tournamentId/:classId', authenticate, createPairi
router.put('/pairing/:clubId/:tournamentId/:pairingId', authenticate, updatePairing);
router.delete('/pairing/:clubId/:tournamentId/:pairingId', authenticate, deletePairing);
// Tournament Stages (mehrere Runden)
router.get('/stages', authenticate, getStages);
router.put('/stages', authenticate, upsertStages);
router.post('/stages/advance', authenticate, advanceStage);
// Muss NACH allen festen Pfaden stehen, sonst matcht z.B. '/stages' als clubId='stages'
router.get('/:clubId', authenticate, getTournaments);
router.post('/', authenticate, addTournament);
export default router;