Skip to content
Snippets Groups Projects
Commit 9f143387 authored by Häderle Marius's avatar Häderle Marius
Browse files

08.01.2024 - added method updateTeamName to Service #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;
......@@ -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;
}
......@@ -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;
}
/*
......
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