Skip to content
Snippets Groups Projects
Commit c6e73bd2 authored by Schneider Stefan's avatar Schneider Stefan
Browse files

08.01.2024 - added updateTournamentName method #24

parent 441b6238
No related branches found
No related tags found
1 merge request!7Dev in Main Merge
......@@ -2,6 +2,7 @@ package hdm.mi.sthbackend.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
......@@ -15,7 +16,7 @@ import java.util.UUID;
public class Tournament implements ITournament{
@Id
private UUID tournamentId;
@Setter
private String tournamentName;
private List<Match> matches;
......
......@@ -198,6 +198,15 @@ public class TournamentService {
log.debug("Score von Team " + teamId + " auf " + newScore + " geupdatet");
}
public UUID updateTournamentName(UUID tournamentId, String newTournamentName)throws TournamentIdNotFoundException{
Tournament tournament = tournamentRepository.findById(tournamentId)
.orElseThrow(() -> new TournamentIdNotFoundException(tournamentId));
tournament.setTournamentName(newTournamentName);
tournamentRepository.save(tournament);
log.debug("Tournament Name for TournamentID " + tournamentId + " updated to " + newTournamentName);
return tournamentId;
}
/*
Weitere Methoden:
UpdateTeamScore Marius
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment