Fixed key serialization bug by using team UUID instead of Team Object

This commit is contained in:
2026-02-04 14:40:01 +01:00
parent 5280ebd764
commit 568bdcb470

View File

@@ -26,7 +26,7 @@ public class Station {
private Set<Team> passedTeams; private Set<Team> passedTeams;
@ElementCollection @ElementCollection
private Map<Team, LocalDate> passingTimes; private Map<UUID, LocalDate> passingTimes;
public Station(String name, String location){ public Station(String name, String location){
this.name = name; this.name = name;
@@ -40,13 +40,13 @@ public class Station {
if(!passedTeams.add(team)){ if(!passedTeams.add(team)){
throw new TeamExistsException("Team %s was already seen at this Station: %s".formatted(team.getTeamName(), this.location), team); throw new TeamExistsException("Team %s was already seen at this Station: %s".formatted(team.getTeamName(), this.location), team);
} }
passingTimes.put(team, LocalDate.now()); passingTimes.put(team.getId(), LocalDate.now());
} }
public void removePassedTeam(Team team){ public void removePassedTeam(Team team){
if (!passedTeams.contains(team)) throw new TeamNotFoundException("Team %s was never seen at this station: %s".formatted(team.getTeamName(), this.location)); if (!passedTeams.contains(team)) throw new TeamNotFoundException("Team %s was never seen at this station: %s".formatted(team.getTeamName(), this.location));
passedTeams.remove(team); passedTeams.remove(team);
passingTimes.remove(team); passingTimes.remove(team.getId());
} }
public String setPasswordHash(String passwordHash){ public String setPasswordHash(String passwordHash){