Skip to content

Commit

Permalink
[MS-193] Refactor: 혼자 있는 방 매칭완료 불가능
Browse files Browse the repository at this point in the history
  • Loading branch information
tjdgns8439 committed Jul 30, 2024
1 parent d83d30a commit 1b283e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public enum ParticipateErrorCode implements ErrorCode {
ROOM_IS_FULL("PRT_006", "방의 정원이 꽉 찬 상태입니다.", HttpStatus.CONFLICT),
USER_NOT_IN_ROOM("PRT_007", "사용자가 해당 채팅방에 없습니다.", HttpStatus.BAD_REQUEST),
USER_ALREADY_IN_OTHER_ROOM("PRT_008", "해당 사용자가 다른 방에 참여한 상태입니다.", HttpStatus.BAD_REQUEST),
USER_ALONE_IN_ROOM("PRT_009", "혼자 있는 방은 매칭완료할 수 없습니다.", HttpStatus.BAD_REQUEST),
;

private final String errorCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.modutaxi.api.common.converter.NaverMapConverter;
import com.modutaxi.api.common.converter.RoomTagBitMaskConverter;
import com.modutaxi.api.common.exception.BaseException;
import com.modutaxi.api.common.exception.errorcode.ParticipateErrorCode;
import com.modutaxi.api.common.exception.errorcode.RoomErrorCode;
import com.modutaxi.api.common.exception.errorcode.SpotError;
import com.modutaxi.api.common.exception.errorcode.TaxiInfoErrorCode;
Expand Down Expand Up @@ -269,6 +270,10 @@ public UpdateRoomResponse finishMatching(Member manager, Long roomId) {

checkManager(room.getRoomManager().getId(), manager.getId());

if (participantRepository.findAllByRoom(room).size() == 1) {
throw new BaseException(ParticipateErrorCode.USER_ALONE_IN_ROOM);
}

if (!room.getRoomStatus().equals(RoomStatus.BEFORE_MATCHING)) {
throw new BaseException(RoomErrorCode.ALREADY_MATCHING_COMPLETE);
}
Expand Down

0 comments on commit 1b283e8

Please sign in to comment.