feat(official-tournaments): implement reimport functionality for official tournaments
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 57s
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 57s
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user