This commit is contained in:
@@ -3,8 +3,10 @@ package nl.connectedit.swiss.mapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import nl.connectedit.swiss.domain.entity.Team;
|
||||
import nl.connectedit.swiss.domain.entity.TournamentPlayer;
|
||||
import nl.connectedit.swiss.domain.entity.TournamentPlayerSubstitution;
|
||||
import nl.connectedit.swiss.dto.TeamDto;
|
||||
import nl.connectedit.swiss.dto.TournamentPlayerDto;
|
||||
import nl.connectedit.swiss.dto.TournamentPlayerSubstitutionDto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -23,7 +25,24 @@ public class TournamentPlayerMapper implements DtoMapper<TournamentPlayer, Tourn
|
||||
tournamentPlayerDto.setPresent(tournamentPlayer.isPresent());
|
||||
tournamentPlayerDto.setCounting(tournamentPlayer.isCounting());
|
||||
tournamentPlayerDto.setCounts(tournamentPlayer.getCounts());
|
||||
if (tournamentPlayer.getSubstitutions() != null) {
|
||||
tournamentPlayerDto.setSubstitutions(
|
||||
tournamentPlayer.getSubstitutions()
|
||||
.stream()
|
||||
.map(this::mapSubstitution)
|
||||
.toList());
|
||||
}
|
||||
|
||||
return tournamentPlayerDto;
|
||||
}
|
||||
|
||||
private TournamentPlayerSubstitutionDto mapSubstitution(TournamentPlayerSubstitution tournamentPlayerSubstitution) {
|
||||
var tournamentPlayerSubstitutionDto = new TournamentPlayerSubstitutionDto();
|
||||
tournamentPlayerSubstitutionDto.setEvent(tournamentPlayerSubstitution.getEvent().getType().name());
|
||||
if (tournamentPlayerSubstitution.getSubstitute() != null) {
|
||||
tournamentPlayerSubstitutionDto.setSubstitute(toDto(tournamentPlayerSubstitution.getSubstitute()));
|
||||
}
|
||||
|
||||
return tournamentPlayerSubstitutionDto;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user