Skip to content

Commit e51fbe8

Browse files
committed
♻️ pr 리뷰 반영 - 비밀번호 확인 로직 메소드 분리
1 parent 683be42 commit e51fbe8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

backend/src/main/java/io/f1/backend/domain/game/app/RoomService.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ public void enterRoom(RoomValidationRequest request) {
131131
throw new CustomException(RoomErrorCode.ROOM_USER_LIMIT_REACHED);
132132
}
133133

134-
if (room.getRoomSetting().locked()
135-
&& !room.getRoomSetting().password().equals(request.password())) {
134+
if (room.isPasswordIncorrect(request.password())) {
136135
throw new CustomException(RoomErrorCode.WRONG_PASSWORD);
137136
}
138137

backend/src/main/java/io/f1/backend/domain/game/model/Room.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,8 @@ public boolean isSameRoom(Long otherRoomId) {
195195
public boolean isPlayerInState(Long userId, ConnectionState state) {
196196
return getPlayerState(userId).equals(state);
197197
}
198+
199+
public boolean isPasswordIncorrect(String password) {
200+
return roomSetting.locked() && !roomSetting.password().equals(password);
201+
}
198202
}

0 commit comments

Comments
 (0)