fix(BlackJackGameController): improve game existence check
This commit is contained in:
parent
126681dfa4
commit
40b717745d
1 changed files with 2 additions and 1 deletions
|
@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
@Slf4j
|
||||
|
@ -35,7 +36,7 @@ public class BlackJackGameController {
|
|||
|
||||
UserEntity user = optionalUser.get();
|
||||
BlackJackGameEntity game = blackJackService.getBlackJackGame(id);
|
||||
if (game == null) {
|
||||
if (game == null || !Objects.equals(game.getUserId(), user.getId())) {
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue