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