feat: add number of tables to tournament updates and enhance related UI components
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 47s
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 47s
This commit is contained in:
@@ -1849,8 +1849,8 @@ class TournamentService {
|
||||
return JSON.parse(JSON.stringify(t));
|
||||
}
|
||||
|
||||
// Update Turnier (Name, Datum und Gewinnsätze)
|
||||
async updateTournament(userToken, clubId, tournamentId, name, date, winningSets) {
|
||||
// Update Turnier (Name, Datum, Gewinnsätze und Tischanzahl)
|
||||
async updateTournament(userToken, clubId, tournamentId, name, date, winningSets, numberOfTables) {
|
||||
await checkAccess(userToken, clubId);
|
||||
const tournament = await Tournament.findOne({ where: { id: tournamentId, clubId } });
|
||||
if (!tournament) {
|
||||
@@ -1873,6 +1873,12 @@ class TournamentService {
|
||||
}
|
||||
tournament.winningSets = winningSets;
|
||||
}
|
||||
if (numberOfTables !== undefined) {
|
||||
if (numberOfTables !== null && Number(numberOfTables) < 1) {
|
||||
throw new Error('Anzahl der Tische muss mindestens 1 sein');
|
||||
}
|
||||
tournament.numberOfTables = numberOfTables != null ? Number(numberOfTables) : null;
|
||||
}
|
||||
|
||||
await tournament.save();
|
||||
return JSON.parse(JSON.stringify(tournament));
|
||||
|
||||
Reference in New Issue
Block a user