[feature/#719] 게임판 랜덤 매칭 API 구현 - #733
Merged
Merged
Conversation
kanghana1
requested changes
Aug 24, 2026
kanghana1
left a comment
Contributor
There was a problem hiding this comment.
고생하셨습니다! 리뷰 한 번 확인해주세요
| throw new GameException(GameErrorCode.INSUFFICIENT_GENDER_COMPOSITION); | ||
| } | ||
|
|
||
| int selectedIndex = ThreadLocalRandom.current().nextInt(availableTypes.size()); |
Contributor
There was a problem hiding this comment.
타입 가능 여부는 전역 후보 성별 수로 판정하지만, 풀 구성은 경기수 격차 창(MAX_GAME_COUNT_GAP=5) 안에서만 성립하고 실패 시 RANDOM_MATCH_NOT_FOUND가 발생할 거 같습니다.
가능한 타입들을 순회하며 풀 구성에 성공하는 타입을 채택하고, 전부 실패할 때만 예외를 던지거나, gap에서 못찾으면 최후의 보루로 격차제한을 풀어서 매칭을 보장하면 안전할 거 같은데, 어떻게 생각하시는지 궁금합니다!
Contributor
Author
There was a problem hiding this comment.
흠 이 부분은 피그마에 적힌 요구사항대로 구현한 부분인데 PM님과 논의가 필요해보입니다!
| ACTIVE_GAME_MEMBER_CANNOT_BE_INACTIVE(HttpStatus.BAD_REQUEST, "GAME413", "진행 또는 대기 중인 게임에 포함된 선수는 참여 해제할 수 없습니다."), | ||
| INACTIVE_GAME_PLAYER(HttpStatus.BAD_REQUEST, "GAME414", "불참 상태의 선수는 게임에 추가할 수 없습니다.") | ||
| INACTIVE_GAME_PLAYER(HttpStatus.BAD_REQUEST, "GAME414", "불참 상태의 선수는 게임에 추가할 수 없습니다."), | ||
| INSUFFICIENT_AVAILABLE_PLAYERS(HttpStatus.BAD_REQUEST, "GAME415", "대기 중인 인원이 부족합니다."), |
Contributor
There was a problem hiding this comment.
요거 "대기중인" 보다는 "매칭가능한"이 조금 더 의미가 통할 거 같은데 어떻게 생각하시나요? 중요한건 아니지만 제안드려봅니다!
|
|
||
| GameMatchType matchType = matchTypeSelector.select(candidates); | ||
| List<GameBoardMember> candidatePool = candidatePoolSelector.select(candidates, matchType); | ||
| List<Game> completedGames = gameRepository.findByGameBoardIdAndStatusInWithPlayers( |
Contributor
There was a problem hiding this comment.
매 호출마다 COMPLETED 게임 전체를 players까지 로드해 페어 이력을 재계산하는 거 같습니다! 완료 게임이 많이 쌓이면 비용이 기하급수적으로 늘 수 있을 거 같습니다. 집계 쿼리로 경량화 가능할 거 같아요!
Dimo-2562
force-pushed
the
feature/#719
branch
from
August 24, 2026 22:10
bea8511 to
d422e26
Compare
Dimo-2562
force-pushed
the
feature/#719
branch
from
August 24, 2026 22:11
d422e26 to
8a2c2bb
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
❤️ 기능 설명
게임판에서 바로 참여 가능한 선수 4명을 추천하는 랜덤 매칭 API를 구현했습니다.
POST /api/game-boards/{gameBoardId}/games/random-matchCREATE_GAME에서 선수 상태를 다시 검증연결된 issue
close #719
🩷 Approve 하기 전 확인해주세요!
CREATE_GAME대기 생성 경로에 선수 가용 상태 재검증 로직을 추가했습니다.domain/game/domain/service아래에 배치했습니다.✅ 체크리스트
테스트
GAME415~417, 401·403·404 통합 테스트 통과