Skip to content

Conversation

@Jjiggu
Copy link
Contributor

@Jjiggu Jjiggu commented Aug 29, 2025

작업 요약

  • 주점 조회 public code 사용하도록 리팩토링

Issue Link

#290

문제점 및 어려움

해결 방안

Reference

Summary by CodeRabbit

  • 신규 기능

    • 매장 응답(상세/검색/목록)에 공개용 식별자(publicCode) 필드가 추가되었습니다.
  • 버그 수정

    • 내 대기 정보 조회 시 누락된 예약을 감지하면 적절한 예외 처리가 적용됩니다.
  • 리팩터링

    • 매장 상세 조회가 숫자 ID 대신 공개용 코드(publicCode)로 조회되도록 변경되어 클라이언트는 publicCode로 요청해야 합니다.

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

coderabbitai bot commented Aug 29, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

컨트롤러와 서비스 시그니처를 매장 식별자 storeId: Long에서 publicCode: String으로 전환하고, 저장소 조회를 findByPublicCodeAndDeletedFalse(publicCode)로 변경했습니다. DTO들(StorePageReadResponse, StoreSearchResponse)에 publicCode 필드를 추가했고, 예약 조회 로직에서 누락된 예약 ID 처리(예외 발생)를 추가했습니다.

Changes

Cohort / File(s) Summary
공개코드 기반 조회 전환
nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/controller/StoreController.java, nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/service/StoreService.java, nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/service/StoreServiceImpl.java
컨트롤러 PathVariable 및 서비스 시그니처를 storeId: LongpublicCode: String로 변경. 구현은 findByPublicCodeAndDeletedFalse(publicCode)로 조회하고 조회된 store.getStoreId()를 로컬로 사용해 기존 대기/북마크/이미지 로직을 유지하도록 수정.
DTO 보강
nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/dto/StorePageReadResponse.java, nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/dto/StoreSearchResponse.java
publicCode: String 필드 추가 및 fromEntity 빌더에 store.getPublicCode() 매핑 추가.
예약 누락 처리 추가
nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/service/ReservationService.java
myWaitingInfo 흐름에서 Redis로부터 조회한 reservationId가 null인 경우 ReservationNotFoundException을 던지도록 검사/처리 추가(메서드 시그니처 변경 없음).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Client as 클라이언트
  participant Controller as StoreController
  participant Service as StoreService
  participant Impl as StoreServiceImpl
  participant Repo as StoreRepository
  participant Aux as Dept/Bookmark/Image/Redis

  Client->>Controller: GET /stores/{publicCode}
  Controller->>Service: getStoreByPublicCode(publicCode, user)
  Service->>Impl: 실행 위임(publicCode, user)
  Impl->>Repo: findByPublicCodeAndDeletedFalse(publicCode)
  Repo-->>Impl: Store 엔티티
  Note right of Impl: storeId = store.getStoreId() 계산
  Impl->>Aux: 부서/북마크/이미지/대기열 조회 (storeId, user)
  Aux-->>Impl: 데이터 집계
  Impl-->>Service: StoreDetailReadResponse 반환
  Service-->>Controller: 응답 전달
  Controller-->>Client: 200 OK (ApiUtils.success)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • HyemIin

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0cf1418 and 2324e04.

📒 Files selected for processing (5)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/reservation/service/ReservationService.java (2 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/controller/StoreController.java (1 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/dto/StoreSearchResponse.java (2 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/service/StoreService.java (1 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/service/StoreServiceImpl.java (2 hunks)
✨ 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/#290-public-code

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.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit 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:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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 August 29, 2025 09:37
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: 4

🧹 Nitpick comments (3)
nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/service/StoreServiceImpl.java (2)

153-153: 불필요한 세미콜론 제거

빈 문장 생성(무해하지만 불필요). 정리 권장.

- Long storeId = store.getStoreId();;
+ Long storeId = store.getStoreId();

150-150: DB 제약/인덱스 확인 권장

publicCode 단건 조회를 전제로 한다면 컬럼에 유니크 제약 및 인덱스 존재 여부를 확인/추가해 주세요.

nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/controller/StoreController.java (1)

50-50: API 문서 텍스트 정합성(ID → public code)

스웨거 문구를 public code 기준으로 수정해 주세요.

- @Operation(summary = "주점 ID로 주점 상세 조회", description = "특정 주점을 ID로 조회합니다.")
+ @Operation(summary = "public code로 주점 상세 조회", description = "특정 주점을 public code로 조회합니다.")
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e3ec59d and 0cf1418.

📒 Files selected for processing (4)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/controller/StoreController.java (1 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/dto/StorePageReadResponse.java (2 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/service/StoreService.java (1 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/service/StoreServiceImpl.java (1 hunks)
🔇 Additional comments (1)
nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/dto/StorePageReadResponse.java (1)

18-18: publicCode 필드 추가 및 매핑 LGTM

DTO에 publicCode 포함과 fromEntity 매핑이 요구사항과 일치합니다.

Also applies to: 49-49

}

@GetMapping("/{storeId}")
@GetMapping("/{publicCode}")
Copy link

@coderabbitai coderabbitai bot Aug 29, 2025

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

publicCode 전환 마무리: 경로 패턴 제한 + 메서드/호출 네이밍 정리

  • 경로 변수에 허용 패턴을 명시해 라우팅 모호성 방지.
  • 메서드/서비스 호출 명도 publicCode에 맞춰 통일.
- @GetMapping("/{publicCode}")
+ @GetMapping("/{publicCode:[A-Za-z0-9_-]+}")
@@
- public ResponseEntity<?> getStoreById(@PathVariable String publicCode, @AuthenticationPrincipal CustomOAuth2User customOAuth2User) {
+ public ResponseEntity<?> getStoreByPublicCode(@PathVariable String publicCode, @AuthenticationPrincipal CustomOAuth2User customOAuth2User) {
@@
-                     storeService.getStoreByStoreId(publicCode, customOAuth2User)
+                     storeService.getStoreByPublicCode(publicCode, customOAuth2User)

Also applies to: 52-52, 57-57

🤖 Prompt for AI Agents
In
nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/controller/StoreController.java
around lines 49, 52 and 57, the @GetMapping path variables lack an explicit
allowed pattern and the controller/service method names still reference the old
identifier; update the route annotations to restrict the publicCode path
variable to the intended pattern (e.g., alphanumerics and hyphen) to avoid
routing ambiguity, and rename the controller methods and any service calls to
consistently use "publicCode" in their method names/parameters so the API and
service layer reflect the new publicCode semantics.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

나중에 보완할게. 이슈 등록 부탁해

Copy link

Choose a reason for hiding this comment

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

🧩 Analysis chain

@Jjiggu 네, 이슈를 등록해드리겠습니다.


🏁 Script executed:

#!/bin/bash
# Create a GitHub issue for the publicCode refactoring improvements
gh issue create \
  --title "주점 조회 API publicCode 패턴 제한 및 메서드명 일관성 개선" \
  --body "## 배경
PR #297에서 주점 조회가 storeId에서 publicCode를 사용하도록 리팩토링되었으나, 추가 개선사항이 있습니다.

## 개선 필요사항

### 1. 경로 변수 패턴 제한
- publicCode 경로 변수에 허용 패턴을 명시하여 라우팅 모호성 방지
- 예: \`@GetMapping(\"/{publicCode:[A-Za-z0-9_-]+}\")\`

### 2. 메서드명 일관성
- 컨트롤러 메서드명을 publicCode 의미에 맞게 변경
- 서비스 호출 메서드명도 일관성 있게 수정
- \`getStoreById\` → \`getStoreByPublicCode\`
- \`getStoreByStoreId\` → \`getStoreByPublicCode\`

## 참고 링크
- 관련 PR: https://github.com/GTable/NoWait_BE_MultiModule/pull/297
- 코드리뷰 코멘트: https://github.com/GTable/NoWait_BE_MultiModule/pull/297#discussion_r2309702381
- 요청자: @Jjiggu

## 파일 범위
- \`nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/controller/StoreController.java\`
- \`nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/service/StoreService.java\`
- \`nowait-app-user-api/src/main/java/com/nowait/applicationuser/store/service/StoreServiceImpl.java\`" \
  --assignee Jjiggu

Length of output: 1015


@Jjiggu 이슈가 성공적으로 등록되었습니다!

📋 이슈 #298: 주점 조회 API publicCode 패턴 제한 및 메서드명 일관성 개선

publicCode 패턴 제한 및 메서드명 일관성 개선사항들이 이슈로 정리되어 나중에 작업하실 수 있도록 준비되었습니다. 현재 PR은 그대로 진행하시면 됩니다! 🚀

🐰
/| /|
( ✌️ )|
| |

@Jjiggu Jjiggu merged commit 10261f3 into develop Aug 29, 2025
1 check was pending
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