Invallers
All checks were successful
Gitea/swiss-backend/pipeline/head This commit looks good

This commit is contained in:
2025-09-11 23:43:10 +02:00
parent d7dee35d6e
commit da7ea66d3e
10 changed files with 111 additions and 9 deletions

View File

@@ -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;
}
}