Skip to content

Conversation

@Jjiggu
Copy link
Contributor

@Jjiggu Jjiggu commented Jul 30, 2025

작업 요약

  • 웨이팅 목록 없는 경우 예외 처리 추가
  • 당일 웨이팅 목록 조회 메서드 분리

Issue Link

#192

문제점 및 어려움

해결 방안

Reference

Summary by CodeRabbit

  • 버그 수정

    • 예약 완료 대기 사용자 목록 조회 시 인증된 사용자 정보가 반영되어 접근 권한이 강화되었습니다.
    • 날짜 및 시간대 처리(Asia/Seoul)가 명확해져 오늘 기준의 예약 데이터가 정확하게 조회됩니다.
    • 대기 상태 처리 시 데이터 정합성을 위해 DB 저장 후에만 대기 데이터가 정리됩니다.
  • 리팩터링

    • 사용되지 않는 예약 관련 조회 기능이 제거되어 시스템이 간결해졌습니다.

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

coderabbitai bot commented Jul 30, 2025

"""

Walkthrough

컨트롤러의 getCompletedReservationList 엔드포인트에서 서비스 호출 시 인증된 사용자 정보를 추가로 전달하도록 수정되었습니다. 서비스 계층에서는 사용자 권한 및 매장 소속 검증, 타임존("Asia/Seoul")을 고려한 날짜 처리, 예약 결과가 없을 경우 예외 처리 등이 추가되었으며, Redis 대기 데이터 삭제 시점이 DB 저장 후로 변경되었습니다. 레포지토리에서는 일부 불필요한 쿼리 메소드가 삭제되었습니다.

Changes

Cohort / File(s) Change Summary
Controller: 인증 정보 전달
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/controller/ReservationController.java
getCompletedWaitingUserDetails 호출 시 memberDetails(인증 사용자 정보) 파라미터 추가
Service: 권한 검증 및 날짜 처리 개선, Redis 삭제 시점 변경
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/service/ReservationService.java
getCompletedWaitingUserDetails 시그니처 변경 및 권한 검증 로직 추가, 타임존("Asia/Seoul") 기반 날짜 처리, 예약 미존재 시 예외 발생, Redis 대기 데이터 삭제 시점 DB 저장 후로 변경, 불필요한 import 제거, 쿼리 헬퍼 및 권한 검증 메소드 추가
Repository: 불필요 메소드 제거
nowait-domain/domain-core-rdb/src/main/java/com/nowait/domaincorerdb/reservation/repository/ReservationRepository.java
매장ID/유저ID 기반 예약 조회 등 불필요한 쿼리 메소드 4개 삭제

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant ReservationController
    participant ReservationService
    participant ReservationRepository

    Client->>ReservationController: getCompletedReservationList(storeId, memberDetails)
    ReservationController->>ReservationService: getCompletedWaitingUserDetails(storeId, memberDetails)
    ReservationService->>ReservationService: authorize(memberDetails, storeId)
    ReservationService->>ReservationRepository: findAllByStore_StoreIdAndStatusInAndRequestedAtBetween(...)
    ReservationRepository-->>ReservationService: 예약 리스트 반환
    ReservationService-->>ReservationController: WaitingUserResponse 리스트 반환
    ReservationController-->>Client: 응답 반환
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15–20 minutes

Possibly related PRs

Suggested reviewers

  • HyemIin
    """

📜 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 ff89372 and 10de217.

📒 Files selected for processing (1)
  • nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/service/ReservationService.java (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/service/ReservationService.java
✨ 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/#192-waiting-filtering

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot requested a review from HyemIin July 30, 2025 02:52
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/service/ReservationService.java (1)

318-325: 권한 검증 로직이 잘 구현되었습니다.

authorize 메서드는 다음과 같이 적절하게 구현되었습니다:

  • 사용자 존재 여부 확인
  • 역할 기반 권한 검증 (SUPER_ADMIN은 모든 매장 접근 가능)
  • 리소스 기반 권한 검증 (일반 사용자는 자신의 매장만 접근)
  • 적절한 예외 처리

성능 최적화를 위해 빈번한 권한 검증 호출 시 사용자 정보 캐싱을 고려해보세요:

// 예시: 메서드 레벨 캐싱 어노테이션 추가
@Cacheable(value = "userAuth", key = "#member.id + '_' + #storeId")
private User authorize(Long storeId, MemberDetails member) {
    // 기존 로직
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8d0bda8 and ff89372.

📒 Files selected for processing (3)
  • nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/controller/ReservationController.java (1 hunks)
  • nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/service/ReservationService.java (2 hunks)
  • nowait-domain/domain-core-rdb/src/main/java/com/nowait/domaincorerdb/reservation/repository/ReservationRepository.java (1 hunks)
🔇 Additional comments (5)
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/controller/ReservationController.java (1)

56-56: LGTM! 인증 정보 전달이 적절합니다.

서비스 계층에서 권한 검증을 수행할 수 있도록 인증된 사용자 정보를 전달하는 변경사항이 올바릅니다. 컨트롤러에서 서비스로의 책임 분리가 잘 이루어졌습니다.

nowait-domain/domain-core-rdb/src/main/java/com/nowait/domaincorerdb/reservation/repository/ReservationRepository.java (1)

19-19: ReservationRepository 인터페이스 정리 확인됨

삭제된 메서드(findByStore_StoreIdAndUserId, findByStore_StoreIdAndUserIdAndRequestedAtBetween, findByStore_StoreIdAndUserIdAndStatusInAndRequestedAtBetween, 원본 findAllByStore_StoreId 등)가 코드베이스에서 호출되지 않음을 확인했습니다.
남아있는 메서드들도 서비스 계층(예: findAllByStore_StoreIdOrderByRequestedAtAsc, findAllByStore_StoreIdAndStatusInAndRequestedAtBetween, findFirstByStore_StoreIdAndUserIdAndStatusInAndRequestedAtBetweenOrderByRequestedAtDesc, existsByUserAndStoreAndStatusIn)과 정확히 맞아떨어집니다.

이 PR을 승인합니다.

nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/service/ReservationService.java (3)

178-189: 권한 검증과 예외 처리 추가가 우수합니다.

메서드에 MemberDetails 파라미터를 추가하고 권한 검증 로직을 포함한 것은 보안 측면에서 매우 좋은 개선사항입니다. 또한 예약 결과가 없을 경우 명시적으로 예외를 던지는 것도 PR 목표에 부합합니다.


305-315: 공통 메서드 추출이 훌륭합니다.

findTodayWaiting 메서드 추출은 다음과 같은 장점이 있습니다:

  • 타임존 처리를 명시적으로 "Asia/Seoul"로 설정
  • 날짜 범위 계산 로직의 재사용성 향상
  • 단일 책임 원칙 준수

코드의 가독성과 유지보수성이 크게 개선되었습니다.


301-326: 재사용 가능한 유사 패턴 없음 확인 완료

findTodayWaitingauthorize는 해당 서비스(ReservationService) 내에서만 사용되고, 다른 코드에는 동일한 권한 검증이나 오늘 날짜 조회 패턴이 존재하지 않습니다.
추가적인 재사용 대상이 없어 현 상태대로 유지해도 무방합니다.

@Jjiggu Jjiggu merged commit 520c1b3 into develop Jul 30, 2025
1 check 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