Compare commits
2 Commits
3365c19f78
...
3baea70356
| Author | SHA1 | Date | |
|---|---|---|---|
| 3baea70356 | |||
| e154c7e4d7 |
@@ -13,6 +13,7 @@ import nl.connectedit.swiss.service.*;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.time.format.DateTimeParseException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -68,7 +69,7 @@ public class TournamentController {
|
|||||||
Tournament tournament;
|
Tournament tournament;
|
||||||
try {
|
try {
|
||||||
tournament = tournamentMapper.toEntity(tournamentDto);
|
tournament = tournamentMapper.toEntity(tournamentDto);
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException | DateTimeParseException e) {
|
||||||
return ResponseEntity.badRequest().build();
|
return ResponseEntity.badRequest().build();
|
||||||
}
|
}
|
||||||
return ResponseEntity.ok(tournamentMapper.toDto(tournamentService.saveTournament(tournament)));
|
return ResponseEntity.ok(tournamentMapper.toDto(tournamentService.saveTournament(tournament)));
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import nl.connectedit.swiss.domain.TournamentStatus;
|
|||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -37,7 +36,7 @@ public class Tournament extends AbstractEntity {
|
|||||||
private TournamentStatus status;
|
private TournamentStatus status;
|
||||||
|
|
||||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||||
private List<Event> events;// = new ArrayList<>();
|
private List<Event> events;
|
||||||
|
|
||||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||||
private List<TournamentPlayer> tournamentPlayers;
|
private List<TournamentPlayer> tournamentPlayers;
|
||||||
|
|||||||
@@ -21,5 +21,7 @@ public class TournamentRegistrationDto extends AbstractDto {
|
|||||||
|
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
private Boolean active;
|
||||||
|
|
||||||
private List<EventRegistrationDto> events;
|
private List<EventRegistrationDto> events;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ public class TournamentPlayerRegistrationMapper {
|
|||||||
tournamentRegistrationDto.setEditable(tournament.getStatus() == TournamentStatus.UPCOMING);
|
tournamentRegistrationDto.setEditable(tournament.getStatus() == TournamentStatus.UPCOMING);
|
||||||
tournamentRegistrationDto.setDate(tournament.getDate().format(DateTimeFormatter.ofPattern("dd-MM-yyyy")));
|
tournamentRegistrationDto.setDate(tournament.getDate().format(DateTimeFormatter.ofPattern("dd-MM-yyyy")));
|
||||||
tournamentRegistrationDto.setStatus(tournament.getStatus().name());
|
tournamentRegistrationDto.setStatus(tournament.getStatus().name());
|
||||||
|
tournamentRegistrationDto.setActive(tournament.getActive());
|
||||||
tournamentRegistrationDto.setEvents(
|
tournamentRegistrationDto.setEvents(
|
||||||
tournament.getEvents()
|
tournament.getEvents()
|
||||||
.stream()
|
.stream()
|
||||||
|
|||||||
Reference in New Issue
Block a user