fix(BlackJackGameController): improve game existence check

This commit is contained in:
Jan K9f 2025-03-27 12:30:01 +01:00
parent 126681dfa4
commit 40b717745d
Signed by: jank
GPG key ID: 22BEAC760B3333D6

View file

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