Compare commits
3 Commits
dd653cb525
...
cca133d67c
| Author | SHA1 | Date | |
|---|---|---|---|
| cca133d67c | |||
| 1385dc56a1 | |||
| 1d0cc270e3 |
7
pom.xml
7
pom.xml
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.5.7</version>
|
||||
<version>3.5.6</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>nl.connected-it</groupId>
|
||||
@@ -50,7 +50,10 @@
|
||||
<artifactId>h2</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Event extends AbstractEntity {
|
||||
@ManyToOne
|
||||
private Tournament tournament;
|
||||
|
||||
@OneToMany(mappedBy = "event", cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
|
||||
@OneToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
|
||||
private List<Registration> registrations;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
|
||||
@@ -30,11 +30,9 @@ public class Match extends AbstractEntity {
|
||||
private Round round;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "team1_id")
|
||||
private Team team1;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "team2_id")
|
||||
private Team team2;
|
||||
|
||||
private Boolean played;
|
||||
|
||||
@@ -58,11 +58,11 @@ public class Player extends AbstractEntity {
|
||||
@Enumerated(EnumType.STRING)
|
||||
private PlayerStrength strength;
|
||||
|
||||
@OneToMany(mappedBy = "player", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||
private List<Registration> registrations;
|
||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||
private List<Registration> registrations;// = new ArrayList<>();
|
||||
|
||||
@OneToMany(mappedBy = "partner", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||
private List<Registration> partnerRegistrations;
|
||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||
private List<Registration> partnerRegistrations;// = new ArrayList<>();
|
||||
|
||||
public String getFullName() {
|
||||
return hasLength(middleName) ?
|
||||
|
||||
@@ -20,8 +20,8 @@ public class Registration extends AbstractEntity {
|
||||
@ManyToOne
|
||||
private Event event;
|
||||
|
||||
// @ManyToOne
|
||||
// private Tournament tournament;
|
||||
@ManyToOne
|
||||
private Tournament tournament;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "player_id")
|
||||
|
||||
@@ -27,7 +27,7 @@ public class Round extends AbstractEntity {
|
||||
|
||||
private Status status;
|
||||
|
||||
@OneToMany(mappedBy = "round", cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
|
||||
@OneToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
|
||||
@OrderBy("id")
|
||||
private List<Match> matches;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public class Tournament extends AbstractEntity {
|
||||
@Enumerated(EnumType.STRING)
|
||||
private TournamentStatus status;
|
||||
|
||||
@OneToMany(mappedBy = "tournament", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||
private List<Event> events;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||
|
||||
@@ -27,7 +27,7 @@ public class RegistrationService {
|
||||
.findAny();
|
||||
if (optionalExistingPlayerRegistration.isEmpty()) { // no previous registration for this event
|
||||
var newRegistration = new Registration();
|
||||
// newRegistration.setTournament(tournament);
|
||||
newRegistration.setTournament(tournament);
|
||||
newRegistration.setEvent(event);
|
||||
newRegistration.setPlayer(player);
|
||||
if (eventRegistration.getPartner() != null) {
|
||||
@@ -53,7 +53,9 @@ public class RegistrationService {
|
||||
private void removeEventFromTournamentPlayer(Tournament tournament, Player player, Event event) {
|
||||
var tournamentPlayer = findOrAddTournamentPlayer(tournament, player);
|
||||
tournamentPlayer.getEvents().removeIf(eventType -> eventType.equals(event.getType().name()));
|
||||
tournamentPlayer.getSubstitutions().removeIf(substitution -> substitution.getEvent().equals(event));
|
||||
if (tournamentPlayer.getSubstitutions() != null) {
|
||||
tournamentPlayer.getSubstitutions().removeIf(substitution -> substitution.getEvent().equals(event));
|
||||
}
|
||||
}
|
||||
|
||||
private void addEventToTournamentPlayer(Tournament tournament, Player player, Event event) {
|
||||
|
||||
Reference in New Issue
Block a user