| 1 | package org.hplr.user.core.usecases.service; | |
| 2 | ||
| 3 | import lombok.AllArgsConstructor; | |
| 4 | import org.hplr.user.core.model.Player; | |
| 5 | import org.hplr.user.core.model.PlayerSnapshot; | |
| 6 | import org.hplr.user.core.usecases.port.dto.PlayerSelectDto; | |
| 7 | import org.hplr.user.core.usecases.port.in.GetPlayerUseCaseInterface; | |
| 8 | import org.hplr.user.core.usecases.port.out.query.SelectPlayerByUserIdQueryInterface; | |
| 9 | import org.hplr.library.exception.HPLRValidationException; | |
| 10 | import org.springframework.stereotype.Service; | |
| 11 | ||
| 12 | import java.util.NoSuchElementException; | |
| 13 | import java.util.Optional; | |
| 14 | import java.util.UUID; | |
| 15 | ||
| 16 | @Service | |
| 17 | @AllArgsConstructor | |
| 18 | public class GetPlayerUseCaseService implements GetPlayerUseCaseInterface { | |
| 19 | ||
| 20 | SelectPlayerByUserIdQueryInterface selectPlayerByUserIdQueryInterface; | |
| 21 | ||
| 22 | @Override | |
| 23 | public PlayerSnapshot getPlayerByUserId(UUID userId) throws NoSuchElementException, HPLRValidationException { | |
| 24 | Optional<PlayerSelectDto> playerSelectDtoOptional = | |
| 25 | selectPlayerByUserIdQueryInterface.selectPlayerByUserId(userId); | |
| 26 | ||
| 27 | Player player = Player.fromDto(playerSelectDtoOptional.orElseThrow(NoSuchElementException::new)); | |
| 28 | ||
| 29 |
1
1. getPlayerByUserId : replaced return value with null for org/hplr/user/core/usecases/service/GetPlayerUseCaseService::getPlayerByUserId → KILLED |
return player.toSnapshot(); |
| 30 | } | |
| 31 | } | |
Mutations | ||
| 29 |
1.1 |