| 1 | package org.hplr.game.infrastructure.dbadapter.adapters; | |
| 2 | ||
| 3 | import lombok.RequiredArgsConstructor; | |
| 4 | import org.hplr.game.core.usecases.port.dto.GameSideSelectDto; | |
| 5 | import org.hplr.game.core.usecases.port.out.query.SelectGameSideBySideIdQueryInterface; | |
| 6 | import org.hplr.game.infrastructure.dbadapter.entities.GameSideEntity; | |
| 7 | import org.hplr.game.infrastructure.dbadapter.mappers.GameSideDatabaseMapper; | |
| 8 | import org.hplr.game.infrastructure.dbadapter.repositories.GameSideRepository; | |
| 9 | ||
| 10 | import org.hplr.library.exception.HPLRIllegalStateException; | |
| 11 | ||
| 12 | import org.springframework.stereotype.Service; | |
| 13 | ||
| 14 | import java.util.Optional; | |
| 15 | import java.util.UUID; | |
| 16 | ||
| 17 | @Service | |
| 18 | @RequiredArgsConstructor | |
| 19 | public class GameSideQueryAdapter implements SelectGameSideBySideIdQueryInterface { | |
| 20 | ||
| 21 | private final GameSideRepository gameSideRepository; | |
| 22 | ||
| 23 | @Override | |
| 24 | public GameSideSelectDto selectGameSideBySideId(UUID sideId) { | |
| 25 | Optional<GameSideEntity> gameSideEntityOptional = gameSideRepository.findBySideId(sideId); | |
| 26 |
1
1. selectGameSideBySideId : negated conditional → KILLED |
if (gameSideEntityOptional.isPresent()) { |
| 27 |
1
1. selectGameSideBySideId : replaced return value with null for org/hplr/game/infrastructure/dbadapter/adapters/GameSideQueryAdapter::selectGameSideBySideId → KILLED |
return GameSideDatabaseMapper.fromEntity(gameSideEntityOptional.get()); |
| 28 | } | |
| 29 | throw new HPLRIllegalStateException("Game side not found!"); | |
| 30 | } | |
| 31 | } | |
Mutations | ||
| 26 |
1.1 |
|
| 27 |
1.1 |