| 1 | package org.hplr.game.core.usecases.service; | |
| 2 | ||
| 3 | import lombok.AllArgsConstructor; | |
| 4 | ||
| 5 | import org.hplr.game.core.model.Game; | |
| 6 | import org.hplr.game.core.model.GameSnapshot; | |
| 7 | import org.hplr.game.core.usecases.port.dto.GameSelectDto; | |
| 8 | import org.hplr.game.core.usecases.port.in.GetGameByIDUseCaseInterface; | |
| 9 | import org.hplr.game.core.usecases.port.out.query.SelectGameByGameIdQueryInterface; | |
| 10 | ||
| 11 | import org.hplr.library.exception.HPLRIllegalArgumentException; | |
| 12 | import org.hplr.library.exception.HPLRIllegalStateException; | |
| 13 | ||
| 14 | import org.springframework.stereotype.Service; | |
| 15 | ||
| 16 | import java.util.NoSuchElementException; | |
| 17 | import java.util.Optional; | |
| 18 | import java.util.UUID; | |
| 19 | ||
| 20 | @AllArgsConstructor | |
| 21 | @Service | |
| 22 | public class GetGameByIDUseCaseService implements GetGameByIDUseCaseInterface { | |
| 23 | ||
| 24 | SelectGameByGameIdQueryInterface selectGameByGameIdQueryInterface; | |
| 25 | ||
| 26 | @Override | |
| 27 | public GameSnapshot getGameByID(UUID gameId) throws NoSuchElementException, HPLRIllegalStateException, HPLRIllegalArgumentException { | |
| 28 | Optional<GameSelectDto> gameSelectDtoOptional = | |
| 29 | selectGameByGameIdQueryInterface.selectGameByGameId(gameId); | |
| 30 | ||
| 31 | Game game = Game.fromDto(gameSelectDtoOptional.orElseThrow(NoSuchElementException::new)); | |
| 32 | ||
| 33 |
1
1. getGameByID : replaced return value with null for org/hplr/game/core/usecases/service/GetGameByIDUseCaseService::getGameByID → KILLED |
return game.toSnapshot(); |
| 34 | } | |
| 35 | } | |
Mutations | ||
| 33 |
1.1 |