Skip to content

Conversation

@HyemIin
Copy link
Member

@HyemIin HyemIin commented Jul 26, 2025

작업 요약

Issue Link

문제점 및 어려움

해결 방안

Reference

Summary by CodeRabbit

  • 버그 수정

    • 예약 대기자 및 완료된 대기자 목록 조회 시 오늘 날짜와 상태별로 정확하게 필터링되어 더 신뢰할 수 있는 정보가 제공됩니다.
  • 기능 개선

    • 대기자 상세 정보 조회 시 사용자 닉네임, 생성일, 예약 ID 정보가 보다 정확하게 표시됩니다.

@HyemIin HyemIin self-assigned this Jul 26, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 26, 2025

Walkthrough

ReservationController의 getWaitingUsersWithScore 메서드 반환 타입이 구체적인 제네릭 타입에서 와일드카드 타입으로 변경되었습니다. ReservationService에서는 대기 사용자 및 완료된 사용자 조회 로직이 개선되어, 사용자 닉네임 조회, 랜덤 예약 ID 생성, 예약 상태 및 날짜 필터링 등이 추가되었습니다. ReservationRepository에는 예약 상태와 날짜 범위로 예약을 조회하는 새로운 메서드가 추가되었습니다.

Changes

파일/경로 변경 요약
.../reservation/controller/ReservationController.java getWaitingUsersWithScore 메서드 반환 타입을 ResponseEntity<List> → ResponseEntity<?>로 변경
.../reservation/service/ReservationService.java 대기/완료 사용자 상세 조회 로직 개선, 닉네임 조회, 랜덤 예약 ID 생성, 예약 상태 및 날짜 필터링 추가, 디버깅 출력 추가
.../reservation/repository/ReservationRepository.java 예약 상태·날짜 범위로 예약 조회하는 메서드 추가, 기존 메서드 시그니처 포매팅 변경(기능 변화 없음)

Sequence Diagram(s)

sequenceDiagram
    participant Controller as ReservationController
    participant Service as ReservationService
    participant Repo as ReservationRepository
    participant UserRepo as UserRepository

    Controller->>Service: getWaitingUsersWithScore(storeId)
    Service->>Repo: findByStore_StoreIdAndUserIdAndRequestedAtBetween(...)
    Service->>UserRepo: findById(userId)
    Service->>Repo: findAllByStore_StoreIdAndStatusInAndRequestedAtBetween(...)
    Service-->>Controller: List<WaitingUserResponse> (ResponseEntity<?>)
Loading

Estimated code review effort

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

Possibly related PRs

Suggested reviewers

  • Jjiggu
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/#158_Store예약많은순반환타입개선

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 Jjiggu July 26, 2025 05:27
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: 3

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b463eb1 and 27ab288.

📒 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 (4 hunks)
  • nowait-domain/domain-core-rdb/src/main/java/com/nowait/domaincorerdb/reservation/repository/ReservationRepository.java (1 hunks)
🔇 Additional comments (6)
nowait-domain/domain-core-rdb/src/main/java/com/nowait/domaincorerdb/reservation/repository/ReservationRepository.java (2)

22-23: 코드 포맷팅 개선이 잘 되었습니다.

메서드 시그니처의 가독성이 향상되었습니다.


25-26: 새로운 쿼리 메서드가 적절히 추가되었습니다.

상점 ID, 예약 상태 목록, 날짜 범위로 예약을 조회하는 기능이 Spring Data JPA 명명 규칙에 따라 올바르게 구현되었습니다. 서비스 레이어에서 완료/취소된 예약 조회에 필요한 기능을 제공합니다.

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

9-10: 새로운 import가 적절히 추가되었습니다.

ThreadLocalRandom과 UUID import가 아래 로직에서 사용되는 기능을 위해 올바르게 추가되었습니다.


112-113: 날짜 필터링이 포함된 쿼리 개선이 좋습니다.

오늘 날짜 범위로 예약을 조회하는 로직이 추가되어 더 정확한 데이터 조회가 가능해졌습니다.


117-121: 예약이 존재할 때의 데이터 설정이 적절합니다.

데이터베이스에서 실제 예약 정보를 가져와서 정확한 값들을 설정하는 로직이 올바르게 구현되었습니다.


141-145: 완료된 예약 조회 로직이 효율적으로 개선되었습니다.

새로운 repository 메서드를 사용하여 상태와 날짜 범위로 필터링된 예약만 조회하도록 개선되어 성능과 정확성이 향상되었습니다.

@Operation(summary = "주점별 전체 대기/호출중 리스트 조회", description = "주점에 대한 대기 리스트 조회(WAITING,CALLING)")
@ApiResponse(responseCode = "200", description = "주점별 전체 대기 리스트 조회")
public ResponseEntity<List<WaitingUserResponse>> getWaitingUsersWithScore(@PathVariable Long storeId) {
public ResponseEntity<?> getWaitingUsersWithScore(@PathVariable Long storeId) {
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

반환 타입을 구체적으로 유지하는 것을 권장합니다.

ResponseEntity<?>로 변경하면 타입 안전성이 감소하고 API 계약이 불분명해집니다. 메서드가 실제로는 List<WaitingUserResponse>를 반환하므로, 원래의 구체적인 타입 ResponseEntity<List<WaitingUserResponse>>을 유지하는 것이 좋습니다.

-public ResponseEntity<?> getWaitingUsersWithScore(@PathVariable Long storeId) {
+public ResponseEntity<List<WaitingUserResponse>> getWaitingUsersWithScore(@PathVariable Long storeId) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public ResponseEntity<?> getWaitingUsersWithScore(@PathVariable Long storeId) {
public ResponseEntity<List<WaitingUserResponse>> getWaitingUsersWithScore(@PathVariable Long storeId) {
🤖 Prompt for AI Agents
In
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/controller/ReservationController.java
at line 39, the method return type is declared as ResponseEntity<?> which
reduces type safety and obscures the API contract. Change the return type to
ResponseEntity<List<WaitingUserResponse>> to maintain type specificity and
clarity about the response content.

@Transactional(readOnly = true)
public List<WaitingUserResponse> getAllWaitingUserDetails(Long storeId) {
List<ZSetOperations.TypedTuple<String>> waitingList = waitingRedisRepository.getAllWaitingWithScore(storeId);
System.out.println(waitingList);
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

디버그 출력문을 제거해주세요.

프로덕션 코드에서 System.out.println은 제거되어야 합니다. 로깅이 필요하다면 적절한 로거를 사용하세요.

-System.out.println(waitingList);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
System.out.println(waitingList);
🤖 Prompt for AI Agents
In
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/service/ReservationService.java
at line 95, remove the System.out.println statement used for debugging. If
logging is necessary, replace it with a proper logger call using the project's
logging framework instead of direct standard output.

Comment on lines +107 to +111
String userName = userRepository.getReferenceById(Long.valueOf(userId)).getNickname();
LocalDateTime createdAt = LocalDateTime.now();
String reservationId = String.valueOf(
ThreadLocalRandom.current().nextInt(1, 100));

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

예약 ID 생성 로직에 일관성 문제가 있습니다.

현재 로직에서 예약이 없을 때 랜덤 ID를 생성하고, 예약이 있을 때는 데이터베이스 ID를 사용하는 것은 일관성이 없습니다. 또한 createdAt을 현재 시간으로 설정하는 것도 실제 예약 생성 시간과 다를 수 있어 혼란을 야기할 수 있습니다.

TODO 주석에서도 언급된 것처럼, 예약 생성 시점부터 DB에 저장하거나 일관된 ID 생성 전략을 수립해야 합니다.

-//TODO 개선필요 -> createAt 정확성 및 reservationhId 생성 방법(예약생성부터 DB에 박아야하나....)
-String userName = userRepository.getReferenceById(Long.valueOf(userId)).getNickname();
-LocalDateTime createdAt = LocalDateTime.now();
-String reservationId = String.valueOf(
-    ThreadLocalRandom.current().nextInt(1, 100));
+// 예약이 없는 경우의 기본값 설정을 명확히 하고 일관성 있게 처리
+String userName = null;
+LocalDateTime createdAt = null;
+String reservationId = null;

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/reservation/service/ReservationService.java
around lines 107 to 111, the reservation ID generation is inconsistent by using
a random ID when no reservation exists and a database ID otherwise, and the
createdAt timestamp is set to the current time rather than the actual
reservation creation time. To fix this, implement a consistent ID generation
strategy that either always uses the database-generated ID or a unified method,
and ensure the createdAt timestamp reflects the actual reservation creation
time, ideally by setting it when the reservation is persisted to the database.

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