Skip to content

Conversation

@Jjiggu
Copy link
Contributor

@Jjiggu Jjiggu commented Sep 19, 2025

작업 요약

  • 전역 예외 처리 누락 케이스 추가

Issue Link

#319

문제점 및 어려움

해결 방안

Reference

Summary by CodeRabbit

  • 신규 기능
    • 예약 데이터 불일치 상황에서 표준화된 오류 응답과 코드가 제공되며, HTTP 404 상태로 응답합니다.
  • 버그 수정
    • 예약 관련 데이터 정리 로직을 개선해 대기열/매핑 정보가 더 안정적으로 제거됩니다.

@Jjiggu Jjiggu self-assigned this Sep 19, 2025
@Jjiggu Jjiggu added the refactor 리팩토링 label Sep 19, 2025
@coderabbitai
Copy link

coderabbitai bot commented Sep 19, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

  • GlobalExceptionHandler에 ReservationDataInconsistencyException 전용 핸들러가 추가되어 404 NOT_FOUND와 표준 ErrorResponse를 반환하도록 구성됨.
  • WaitingRedisRepository.deleteWaiting에서 reservationNumber 역매핑 삭제 시 null 체크가 제거되어 항상 삭제 호출이 수행되도록 제어 흐름이 변경됨.

Changes

Cohort / File(s) Summary
예외 처리 확장
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/exception/GlobalExceptionHandler.java
ReservationDataInconsistencyException 처리기 추가: 알람 발송, 로깅, ErrorResponse(RESERVATION_DATA_INCONSISTENCY) 반환, HTTP 404 매핑. 새로운 public 메서드 선언 추가.
Redis 대기열 삭제 흐름 조정
nowait-domain/domain-redis/src/main/java/com/nowait/domaincoreredis/reservation/repository/WaitingRedisRepository.java
deleteWaiting에서 reservationNumber → userId 역매핑 삭제 시 null 가드 제거로 무조건 HDEL 수행. 그 외 키 삭제 로직은 기존과 동일. 외부 공개 시그니처 변경 없음.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Client
  participant Controller
  participant Service
  participant GlobalExceptionHandler as ExceptionHandler

  Client->>Controller: 요청
  Controller->>Service: 비즈니스 로직 수행
  Service-->>Controller: ReservationDataInconsistencyException throw
  note over Controller,ExceptionHandler: 예외 전파
  Controller->>ExceptionHandler: handle(ReservationDataInconsistencyException)
  rect rgba(230,240,255,0.6)
    ExceptionHandler->>ExceptionHandler: 알람 트리거 및 로깅
  end
  ExceptionHandler-->>Client: 404 NOT_FOUND + ErrorResponse(RESERVATION_DATA_INCONSISTENCY)
Loading
sequenceDiagram
  autonumber
  participant Service
  participant WaitingRedisRepository as RedisRepo
  participant Redis as Redis(HSET/HDEL)

  Service->>RedisRepo: deleteWaiting(userId, reservationNumber)
  par 키 정리
    RedisRepo->>Redis: HDEL numberMapKey userId
    RedisRepo->>Redis: HDEL statusKey userId
    RedisRepo->>Redis: ZREM queueKey userId
    RedisRepo->>Redis: HDEL partySizeKey userId
    RedisRepo->>Redis: HDEL calledAtKey userId
  and 역매핑 정리 (변경)
    note over RedisRepo,Redis: 이전: reservationNumber != null일 때만 HDEL<br/>현재: 항상 HDEL 호출
    RedisRepo->>Redis: HDEL userMapKey reservationNumber
  end
  Redis-->>RedisRepo: OK
  RedisRepo-->>Service: 완료
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • HyemIin
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/#319-UserService-exception

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a964faf and 5bac8f2.

📒 Files selected for processing (2)
  • nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/exception/GlobalExceptionHandler.java (2 hunks)
  • nowait-domain/domain-redis/src/main/java/com/nowait/domaincoreredis/reservation/repository/WaitingRedisRepository.java (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot requested a review from HyemIin September 19, 2025 15:54
@Jjiggu Jjiggu merged commit cfbd4d2 into develop Sep 19, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants