feat: unterstütze mehrere Spielplan-Team-IDs und verbessere die Zuordnung importierter Mannschaften
All checks were successful
Code Analysis and Production Deploy / analyze (push) Successful in 7m17s
Code Analysis and Production Deploy / deploy-production (push) Has been skipped
Code Analysis and Production Deploy / deploy-test (push) Successful in 2m46s

This commit is contained in:
Torsten Schulz (local)
2026-07-17 11:49:55 +02:00
parent 75a7c409cd
commit 461f2de8dc
5 changed files with 165 additions and 12 deletions

View File

@@ -2,6 +2,7 @@ import { getUserFromToken, hasAnyRole } from '../../utils/auth.js'
import { importSpielplan } from '../../utils/spielplan-import.js'
import { importLeagueTables } from '../../utils/spielklassen-tables-import.js'
import { publishImportedSpielplan } from '../../utils/spielplan-publish.js'
import { synchronizeMannschaftenSpielplanIds } from '../../utils/mannschaften-spielplan-ids.js'
import { error as loggerError, info as loggerInfo } from '../../utils/logger.js'
export default defineEventHandler(async (event) => {
@@ -22,6 +23,7 @@ export default defineEventHandler(async (event) => {
try {
const imported = await importSpielplan()
const published = await publishImportedSpielplan({ inputPath: imported.jsonFile })
const mapping = await synchronizeMannschaftenSpielplanIds(published.seasonSlug)
let tableMessage = ''
try {
@@ -40,9 +42,10 @@ export default defineEventHandler(async (event) => {
return {
success: true,
message: `Spielplan ${published.seasonSlug} mit ${imported.matchCount} Spielen aktualisiert.${tableMessage}`,
message: `Spielplan ${published.seasonSlug} mit ${imported.matchCount} Spielen aktualisiert. ${mapping.updatedTeams} Mannschaften automatisch zugeordnet.${tableMessage}`,
season: published.seasonSlug,
matchCount: imported.matchCount
matchCount: imported.matchCount,
mappedTeams: mapping.updatedTeams
}
} catch (error) {
loggerError('[cms] Manueller Spielplan-Import fehlgeschlagen:', { error })