feat(official-tournaments): implement reimport functionality for official tournaments
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 57s

This commit is contained in:
Torsten Schulz (local)
2026-09-09 13:16:04 +02:00
parent 0c9a898d61
commit ab4d99192e
4 changed files with 43 additions and 1 deletions

View File

@@ -96,6 +96,18 @@ class OfficialTournamentService {
return repaired;
}
async reimportOfficialTournament(clubId, tournamentId) {
const tournament = await OfficialTournament.findOne({ where: { id: tournamentId, clubId } });
if (!tournament) return null;
const updatedCount = await this.repairTournamentFromSource(clubId, tournament);
if (!tournament.sourceUrl) {
const error = new Error('Für dieses Turnier ist keine myTischtennis-Quelle hinterlegt.');
error.status = 400;
throw error;
}
return { id: String(tournament.id), updatedCount };
}
async saveTournamentSuggestion(clubId, suggestionId) {
const suggestion = await TournamentSuggestion.findOne({ where: { id: suggestionId, clubId } });
if (!suggestion) return null;