diff --git a/sth-backend/src/main/java/hdm/mi/sthbackend/service/TournamentService.java b/sth-backend/src/main/java/hdm/mi/sthbackend/service/TournamentService.java index 4bf7fb2d6cd0f0b2c3d0e0c2975ac5313a7af570..e9503e4b8e1c1d865818325748fbaee88b218898 100644 --- a/sth-backend/src/main/java/hdm/mi/sthbackend/service/TournamentService.java +++ b/sth-backend/src/main/java/hdm/mi/sthbackend/service/TournamentService.java @@ -217,6 +217,22 @@ public class TournamentService { log.debug("Tournament Name for TournamentID " + tournamentId + " updated to " + newTournamentName); return tournamentId; } + public Tournament getTournament(UUID tournamentId) throws TournamentIdNotFoundException { + Tournament tournament = tournamentRepository.findById(tournamentId) + .orElseThrow(() -> new TournamentIdNotFoundException(tournamentId)); + + log.debug(tournament + "is found"); + return tournament; + } + + public void deleteTournament(UUID tournamentId) throws TournamentIdNotFoundException { + Tournament tournamentToDelete = tournamentRepository.findById(tournamentId) + .orElseThrow(() -> new TournamentIdNotFoundException(tournamentId)); + + tournamentRepository.delete(tournamentToDelete); + log.debug("Tournament " + tournamentId + " has been deleted"); + } + /* Weitere Methoden: UpdateTeamScore Marius