diff --git a/sth-backend/src/main/java/hdm/mi/sthbackend/model/Team.java b/sth-backend/src/main/java/hdm/mi/sthbackend/model/Team.java index cb98022bb5354856db4d00fbb881f7f74a70068c..620a1d1bee0a7f6830d7f6c9aa72b8cd79fd4907 100644 --- a/sth-backend/src/main/java/hdm/mi/sthbackend/model/Team.java +++ b/sth-backend/src/main/java/hdm/mi/sthbackend/model/Team.java @@ -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; @@ -14,7 +15,7 @@ import java.util.UUID; public class Team { @Id private final UUID id; - - private final String teamName; + @Setter + private String teamName; private final List<UUID> teamMembers; } 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 703c1fb369c2b7c457689d435542501895bed083..faab404a690c2dda684845d35dfdf2c7add5b285 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 @@ -195,7 +195,17 @@ public class TournamentService { } match.getTeamScores().put(teamId, newScore); tournamentRepository.save(tournament); - log.debug("Score von Team " + teamId + " auf " + newScore + " geupdatet"); + log.debug("Score of Team " + teamId + " updated to " + newScore); + } + + + public UUID updateTeamName(UUID teamId, String newTeamName) throws TeamIdNotFoundException { + Team team = teamRepository.findById(teamId) + .orElseThrow(() -> new TeamIdNotFoundException(teamId)); + team.setTeamName(newTeamName); + teamRepository.save(team); + log.debug("Teamname of " + teamId + " updated to " + newTeamName); + return teamId; } /*