Skip to content

Conversation

@HyemIin
Copy link
Member

@HyemIin HyemIin commented Jul 21, 2025

작업 요약

  • 병준님 요청 사항 기반 항목 추가
  • DepartmentRepository 생성
  • 내 모든 대기열 조회 로직 구현

Issue Link

#128

문제점 및 어려움

해결 방안

Reference

Summary by CodeRabbit

  • 신규 기능

    • 사용자가 신청한 모든 대기열 목록을 조회할 수 있는 새로운 API 엔드포인트가 추가되었습니다.
    • 대기열 정보를 제공하는 새로운 데이터 전송 객체(DTO)가 도입되었습니다.
    • 사용자의 대기열 등록 시간 및 대기 상태 등 상세 정보를 포함한 대기열 조회 기능이 개선되었습니다.
  • 버그 수정

    • 기존 대기열 조회 API의 설명이 보다 명확하게 수정되었습니다.
  • 기타

    • 대기열 데이터의 자동 만료(12시간 TTL) 기능이 추가되었습니다.
    • 활성화된 매장 ID를 조회하는 기능이 추가되어 내부 데이터 조회 성능 개선을 위한 기반이 마련되었습니다.
    • 내부 데이터 조회 성능 개선을 위한 준비 작업이 일부 반영되었습니다.

- 병준님 요청 사항 기반 항목 추가
- DepartmentRepository 생성
- 내 모든 대기열 조회 로직 구현
@HyemIin HyemIin self-assigned this Jul 21, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 21, 2025

"""

Walkthrough

이 변경사항은 사용자가 신청한 모든 대기열 목록을 조회하는 새로운 API 엔드포인트와 DTO를 추가하고, 이를 지원하기 위한 서비스 및 레포지토리 계층의 메서드와 JPA 리포지토리 인터페이스를 도입합니다. 일부 import 정렬 및 기존 엔드포인트 설명도 소폭 수정되었습니다.

Changes

파일/경로 요약 변경 요약
.../order/dto/OrderCreateResponseDto.java import 순서만 변경, 기능 변화 없음
.../reservation/controller/ReservationController.java 사용자의 전체 대기열 목록을 조회하는 GET /my/waitings 엔드포인트 추가, 기존 설명 일부 수정
.../reservation/dto/MyWaitingQueueDto.java 사용자의 대기열 정보를 담는 새로운 DTO 클래스 추가
.../reservation/repository/WaitingRedisRepository.java 사용자별 대기 등록 시각 조회 메서드 및 사용자 대기 중인 매장 ID 목록 조회 메서드 추가, TTL 설정 강화
.../reservation/service/ReservationService.java 전체 대기열 조회 비즈니스 로직 추가, 부서명 조회를 위한 의존성 추가
.../department/repository/DepartmentRepository.java JPA 기반 부서 리포지토리 인터페이스 신규 추가
.../store/repository/StoreRepository.java 활성화된 매장 ID 목록을 조회하는 JPQL 기반 메서드 추가

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant ReservationController
    participant ReservationService
    participant StoreRepository
    participant WaitingRedisRepository
    participant DepartmentRepository

    Client->>ReservationController: GET /my/waitings (with 인증정보)
    ReservationController->>ReservationService: getAllMyWaitings(사용자)
    ReservationService->>StoreRepository: findAllActiveStoreIds()
    loop 각 StoreId
        ReservationService->>WaitingRedisRepository: getRank(storeId, userId)
        alt 사용자가 대기중인 경우
            ReservationService->>WaitingRedisRepository: getWaitingTimestamp(storeId, userId)
            ReservationService->>DepartmentRepository: findById(departmentId)
            ReservationService-->>ReservationService: MyWaitingQueueDto 생성
        end
    end
    ReservationService-->>ReservationController: List<MyWaitingQueueDto>
    ReservationController-->>Client: 응답 반환
Loading

Estimated code review effort

3 (90–240 minutes)

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • Jjiggu
    """

📜 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 a0c5e4d and 10fb5fb.

📒 Files selected for processing (2)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/repository/WaitingRedisRepository.java (3 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/service/ReservationService.java (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/service/ReservationService.java
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/repository/WaitingRedisRepository.java
✨ Finishing Touches
  • 📝 Generate Docstrings

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 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 Jjiggu July 21, 2025 06:54
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: 2

🧹 Nitpick comments (3)
nowait-domain/domain-core-rdb/src/main/java/com/nowait/domaincorerdb/department/repository/DepartmentRepository.java (1)

7-7: import 문을 사용하여 코드 가독성을 개선하세요.

제네릭 타입 파라미터에서 완전한 패키지 경로를 사용하는 대신 import 문을 추가하는 것이 좋습니다.

+import com.nowait.domaincorerdb.department.entity.Department;
+
 @Repository
-public interface DepartmentRepository extends JpaRepository<com.nowait.domaincorerdb.department.entity.Department, Long> {
+public interface DepartmentRepository extends JpaRepository<Department, Long> {
nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/dto/MyWaitingQueueDto.java (1)

17-36: 필드 정의는 적절하나 일부 개선사항이 있습니다.

전반적으로 필요한 정보들이 잘 포함되어 있습니다. 다음 사항들을 고려해보세요:

  1. status 필드가 String으로 되어 있는데, enum 타입 사용을 권장합니다
  2. teamsAheadrank가 중복된 정보일 수 있습니다 (rank = teamsAhead + 1)
-	@Schema(description = "대기 상태", example = "WAITING")
-	private String status;
+	@Schema(description = "대기 상태", example = "WAITING")
+	private WaitingStatus status;

별도의 WaitingStatus enum 생성을 고려해보세요.

nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/service/ReservationService.java (1)

129-129: 하드코딩된 상태값 개선이 필요합니다.

상태값이 하드코딩되어 있고 TODO 주석이 남아있습니다. enum을 활용한 상태 관리를 구현해야 합니다.

WaitingStatus enum을 생성하고 실제 대기 상태를 반영하는 로직 구현을 도와드릴까요?

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9f57e7e and a0c5e4d.

📒 Files selected for processing (7)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/order/dto/OrderCreateResponseDto.java (1 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/controller/ReservationController.java (4 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/dto/MyWaitingQueueDto.java (1 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/repository/WaitingRedisRepository.java (1 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/service/ReservationService.java (3 hunks)
  • nowait-domain/domain-core-rdb/src/main/java/com/nowait/domaincorerdb/department/repository/DepartmentRepository.java (1 hunks)
  • nowait-domain/domain-core-rdb/src/main/java/com/nowait/domaincorerdb/store/repository/StoreRepository.java (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/repository/WaitingRedisRepository.java (1)
nowait-domain/domain-redis/src/main/java/com/nowait/domaincoreredis/common/util/RedisKeyUtils.java (1)
  • RedisKeyUtils (5-43)
🔇 Additional comments (9)
nowait-app-user-api/src/main/java/com/nowait/applicationuser/order/dto/OrderCreateResponseDto.java (1)

7-7: import 정렬 개선이 좋습니다.

import 문의 재정렬로 코드 정리가 잘 되었습니다.

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

26-28: 활성 매장 ID 조회 메서드가 잘 구현되었습니다.

JPQL 쿼리가 올바르게 작성되었고, 필요한 조건들(isActive=true, deleted=false)이 적절히 적용되었습니다. 성능을 위해 ID만 선택하는 것도 좋은 접근입니다.

TODO 주석에 언급된 QueryDSL 전환 계획도 향후 타입 안전성과 유지보수성 측면에서 좋은 방향입니다.

nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/repository/WaitingRedisRepository.java (1)

51-55: 대기 시간 조회 메서드가 올바르게 구현되었습니다.

Redis sorted set에서 사용자의 대기 등록 시간을 조회하는 로직이 적절합니다:

  • 기존 패턴을 따라 RedisKeyUtils를 사용한 키 생성
  • null 처리로 사용자가 대기열에 없는 경우 적절히 핸들링
  • Double에서 Long으로의 안전한 타입 변환

기존 메서드들과 일관된 구조로 잘 작성되었습니다.

nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/controller/ReservationController.java (3)

73-73: API 문서 설명 개선이 좋습니다.

기존 엔드포인트의 설명을 더 명확하게 수정한 것이 좋습니다.


105-111: 서비스 계층 getAllMyWaitings 예외 처리 확인 요청

서비스 메서드 getAllMyWaitings 내에서 다음 지점을 검토해주세요:

  • 파일: nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/service/ReservationService.java
    • throw new IllegalArgumentException("Waiting not found"); 사용 위치
    • 빈 대기목록 조회 시 예외 대신 빈 리스트 반환 또는 404 응답 처리 로직이 필요한지 결정

위 사항을 반영하여 적절한 예외 타입(예: 커스텀 NotFoundException) 혹은 컨트롤러/글로벌 예외 핸들러 매핑이 정상 동작하는지 검증해 주세요.


16-16: MyWaitingQueueDto 및 서비스 메서드 정의 확인 완료

  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/dto/MyWaitingQueueDto.java 클래스 존재 및 필드/어노테이션 모두 적절
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/service/ReservationService.java
    public List<MyWaitingQueueDto> getAllMyWaitings(CustomOAuth2User) 메서드가 올바르게 정의되어 있고 반환 타입이 List<MyWaitingQueueDto>로 일치

추가 수정이나 검증은 필요 없습니다.

nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/dto/MyWaitingQueueDto.java (1)

11-16: DTO 클래스 구조가 적절하게 설계되었습니다.

Lombok 어노테이션과 Swagger 문서화가 잘 적용되어 있고, 대기열 정보를 포괄적으로 담을 수 있는 구조입니다.

nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/service/ReservationService.java (2)

3-6: import 문이 적절히 추가되었습니다.

새로운 기능에 필요한 time 관련 클래스들이 올바르게 import되었습니다.


12-19: 새로운 의존성이 적절히 추가되었습니다.

MyWaitingQueueDtoDepartmentRepository 의존성이 올바르게 추가되었습니다.

Also applies to: 42-42

@HyemIin HyemIin merged commit a2abed2 into develop Jul 21, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants