Skip to content

Conversation

@Jjiggu
Copy link
Contributor

@Jjiggu Jjiggu commented Aug 26, 2025

작업 요약

  • Store 내 publicCode 컬럼 추가
  • 주문 생성 및 조회 시 publicCode 사용하도록 변경

Issue Link

#290

문제점 및 어려움

해결 방안

Reference

Summary by CodeRabbit

  • 신기능
    • 매장 공개 코드(publicCode)가 생성되며 매장 생성 응답에 포함됩니다.
    • 공개 코드를 사용해 메뉴 전체 조회, 단건 조회, 주문 생성, 주문 항목 조회를 수행할 수 있습니다.
  • 리팩터
    • 사용자 API 경로 및 파라미터가 storeId에서 publicCode로 변경되었습니다.
      • 메뉴: /v1/menus/all-menus/stores/{publicCode}, /v1/menus/{publicCode}/{menuId}
      • 주문: POST /create/{publicCode}/{tableId}, GET /items/{publicCode}/{tableId}
    • 기존 응답 구조와 상태 코드는 유지됩니다.

@Jjiggu Jjiggu self-assigned this Aug 26, 2025
@Jjiggu Jjiggu added enhancement New feature or request refactor 리팩토링 labels Aug 26, 2025
@coderabbitai
Copy link

coderabbitai bot commented Aug 26, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Store 식별 체계를 storeId(Long)에서 publicCode(String, base62 12자)로 확장/전환. Store 엔티티/레포지토리에 publicCode 필드와 조회 메서드 추가. User API의 메뉴/주문 컨트롤러·서비스는 publicCode 기반으로 변경. Admin API 생성 요청/응답에 publicCode 반영. 공통 토큰 유틸 추가.

Changes

Cohort / File(s) Summary
Public code 토큰 생성 도입
nowait-common/src/main/java/com/nowait/common/token/TokenGenerator.java
보안난수 기반 base62 토큰 유틸 추가(base62(int)), 길이 12 사용 권장.
Store 엔티티 확장
nowait-domain/domain-core-rdb/src/main/java/com/nowait/domaincorerdb/store/entity/Store.java
publicCode 필드 추가(고유, 불변, 길이 12). Lombok 게터 노출.
Store 조회 경로 추가
nowait-domain/domain-core-rdb/src/main/java/com/nowait/domaincorerdb/store/repository/StoreRepository.java
findByPublicCodeAndDeletedFalse(String) 추가.
Order 조회 조건 전환
nowait-domain/domain-core-rdb/src/main/java/com/nowait/domaincorerdb/order/repository/OrderRepository.java
메서드 시그니처를 Store_StoreIdStore_PublicCode 기준으로 변경.
Admin API 생성 흐름 반영
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/store/dto/StoreCreateRequest.java
toEntity()에서 publicCodeTokenGenerator.base62(12)로 설정.
Admin API 응답 확장
nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/store/dto/StoreCreateResponse.java
DTO에 publicCode 필드·게터·빌더 추가, fromEntity 매핑.
User 메뉴 컨트롤러 전환
nowait-app-user-api/src/main/java/com/nowait/applicationuser/menu/controller/MenuController.java
PathVar storeId(Long)publicCode(String)로 변경, 서비스 호출 인자 수정.
User 메뉴 서비스 전환
nowait-app-user-api/src/main/java/com/nowait/applicationuser/menu/service/MenuService.java
퍼블릭 메서드가 publicCode 수신. StoreRepository.findByPublicCode...로 스토어 조회 후 내부적으로 storeId 사용해 메뉴 조회.
User 주문 컨트롤러 전환
nowait-app-user-api/src/main/java/com/nowait/applicationuser/order/controller/OrderController.java
엔드포인트를 /create/{publicCode}/{tableId}, /items/{publicCode}/{tableId}로 변경. 서비스 호출 인자 publicCode로 전환.
User 주문 서비스 전환
nowait-app-user-api/src/main/java/com/nowait/applicationuser/order/service/OrderService.java
createOrder, getOrderItemsGroupByOrderIdpublicCode 사용. 파라미터 검증/서명 생성 로직이 문자열 publicCode 기반으로 변경. 레포 호출은 publicCode 기준.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User Client
  participant MC as MenuController
  participant MS as MenuService
  participant SR as StoreRepository
  participant MR as MenuRepository

  U->>MC: GET /v1/menus/all-menus/stores/{publicCode}
  MC->>MS: getAllMenusByStoreId(publicCode)
  MS->>SR: findByPublicCodeAndDeletedFalse(publicCode)
  SR-->>MS: Store (storeId, publicCode)
  MS->>MR: findAllByStoreId(store.storeId) [+images...]
  MR-->>MS: Menus
  MS-->>MC: MenuReadResponse
  MC-->>U: 200 OK
Loading
sequenceDiagram
  autonumber
  participant U as User Client
  participant OC as OrderController
  participant OS as OrderService
  participant SR as StoreRepository
  participant OR as OrderRepository

  U->>OC: POST /v1/orders/create/{publicCode}/{tableId}
  OC->>OS: createOrder(publicCode, tableId, payload, sessionId)
  OS->>SR: findByPublicCodeAndDeletedFalse(publicCode)
  SR-->>OS: Store
  OS->>OR: findByStore_PublicCodeAndTableIdAndSessionId(publicCode, tableId, sessionId)
  OR-->>OS: Existing orders (if any)
  OS->>OR: Save order & items (if not duplicate)
  OR-->>OS: Persisted entities
  OS-->>OC: OrderCreateResponseDto
  OC-->>U: 201 Created
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

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 27b935d and 3cfd573.

📒 Files selected for processing (10)
  • nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/store/dto/StoreCreateRequest.java (2 hunks)
  • nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/store/dto/StoreCreateResponse.java (2 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/menu/controller/MenuController.java (1 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/menu/service/MenuService.java (2 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/order/controller/OrderController.java (2 hunks)
  • nowait-app-user-api/src/main/java/com/nowait/applicationuser/order/service/OrderService.java (4 hunks)
  • nowait-common/src/main/java/com/nowait/common/token/TokenGenerator.java (1 hunks)
  • nowait-domain/domain-core-rdb/src/main/java/com/nowait/domaincorerdb/order/repository/OrderRepository.java (1 hunks)
  • nowait-domain/domain-core-rdb/src/main/java/com/nowait/domaincorerdb/store/entity/Store.java (3 hunks)
  • nowait-domain/domain-core-rdb/src/main/java/com/nowait/domaincorerdb/store/repository/StoreRepository.java (1 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 @coderabbitai in a new review comment at the desired location with your query.
  • 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 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 @coderabbitai help to get the list of available commands.

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

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.

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

Labels

enhancement New feature or request refactor 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants