From 89f30f76f5232595f18aa6929ffc02a2048e008d Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Fri, 30 Jan 2026 23:01:41 +0100 Subject: [PATCH] feat(tournament): update mini championship creation to include location - Modified addMiniChampionship method to accept location (ort) instead of tournament name. - Updated frontend components to reflect the change, including new input for location and localization updates for German language support. - Enhanced validation to ensure location is provided during mini championship creation. --- backend/controllers/tournamentController.js | 6 +++--- backend/services/tournamentService.js | 8 +++++++- frontend/src/i18n/locales/de.json | 1 + frontend/src/views/TournamentTab.vue | 14 ++++++++++---- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/backend/controllers/tournamentController.js b/backend/controllers/tournamentController.js index 568a6c3..4bfb580 100644 --- a/backend/controllers/tournamentController.js +++ b/backend/controllers/tournamentController.js @@ -75,12 +75,12 @@ export const addTournament = async (req, res) => { } }; -// Minimeisterschaft anlegen (Turnier + 6 Klassen) +// Minimeisterschaft anlegen (Turnier + 6 Klassen); Name: "Minimeisterschaften Ortsentscheid " export const addMiniChampionship = async (req, res) => { const { authcode: token } = req.headers; - const { clubId, tournamentName, date, year, winningSets } = req.body; + const { clubId, ort, date, year, winningSets } = req.body; try { - const tournament = await tournamentService.addMiniChampionship(token, clubId, tournamentName, date, year, winningSets); + const tournament = await tournamentService.addMiniChampionship(token, clubId, ort, date, year, winningSets); if (clubId && tournament && tournament.id) { emitTournamentChanged(clubId, tournament.id); } diff --git a/backend/services/tournamentService.js b/backend/services/tournamentService.js index 26b5264..fdfd2fe 100644 --- a/backend/services/tournamentService.js +++ b/backend/services/tournamentService.js @@ -716,10 +716,15 @@ class TournamentService { /** * Minimeisterschaft anlegen: Turnier + 6 vorkonfigurierte Klassen (Jungen/Mädchen 12, 10, 8). + * Name wird generiert: "Minimeisterschaften Ortsentscheid ". * Jahr Y: 12 = in Y 11 oder 12 Jahre (Geburtsjahr Y-12 oder Y-11), 10 = 9/10 (Y-10, Y-9), 8 = 8 oder jünger (≥ Y-8). */ - async addMiniChampionship(userToken, clubId, tournamentName, date, year, winningSets = 3) { + async addMiniChampionship(userToken, clubId, ort, date, year, winningSets = 3) { await checkAccess(userToken, clubId); + const ortTrimmed = (ort || '').trim(); + if (!ortTrimmed) { + throw new Error('Ort für die Minimeisterschaft fehlt'); + } const existing = await Tournament.findOne({ where: { clubId, date } }); if (existing) { throw new Error('Ein Turnier mit diesem Datum existiert bereits'); @@ -728,6 +733,7 @@ class TournamentService { if (!Number.isFinite(Y) || Y < 2000 || Y > 2100) { throw new Error('Ungültiges Jahr für die Minimeisterschaft'); } + const tournamentName = `Minimeisterschaften ${Y} Ortsentscheid ${ortTrimmed}`; const t = await Tournament.create({ name: tournamentName, date, diff --git a/frontend/src/i18n/locales/de.json b/frontend/src/i18n/locales/de.json index fb723bd..9d73def 100644 --- a/frontend/src/i18n/locales/de.json +++ b/frontend/src/i18n/locales/de.json @@ -565,6 +565,7 @@ "newMiniChampionship": "Neue Minimeisterschaft", "miniChampionshipYear": "Jahr (Altersstufen)", "miniChampionshipYearHint": "12 = in diesem Jahr 11 oder 12 Jahre, 10 = 9 oder 10, 8 = 8 oder jünger", + "miniChampionshipLocation": "Ort", "tournamentParticipations": "Turnierteilnahmen", "date": "Datum", "newTournament": "Neues Turnier", diff --git a/frontend/src/views/TournamentTab.vue b/frontend/src/views/TournamentTab.vue index 6449104..65e0b83 100644 --- a/frontend/src/views/TournamentTab.vue +++ b/frontend/src/views/TournamentTab.vue @@ -24,8 +24,8 @@