Skip to content

Conversation

@HyemIin
Copy link
Member

@HyemIin HyemIin commented Jul 3, 2025

작업 요약

  • entity에 swagger 의존성 추가
  • order 주문,수정 로직 구현

Issue Link

문제점 및 어려움

해결 방안

Reference

Summary by CodeRabbit

  • 신규 기능

    • 관리자 페이지에서 매장별 주문 목록 조회 및 주문 상태 변경 기능이 추가되었습니다.
    • 주문 상태(WAITING_FOR_PAYMENT, COOKING, COOKED) 관리가 도입되었습니다.
    • 주문 생성 시 주문 내역과 총 금액 입력 및 반환이 가능해졌습니다.
  • 버그 수정

    • 일부 경로 및 의존성 오류가 수정되었습니다.
  • 문서화

    • Swagger/OpenAPI를 통한 API 문서화가 개선되었습니다.

- entity에 swagger 의존성 추가
- order 주문,수정 로직 구현
@HyemIin HyemIin self-assigned this Jul 3, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 3, 2025

"""

Walkthrough

주문(Order) 관리 기능이 전반적으로 확장되었습니다. 관리자용 주문 조회 및 상태 변경 API가 새로 구현되었고, 주문 상태(OrderStatus) 및 총 금액(totalPrice) 필드가 엔티티와 DTO에 추가되었습니다. 관련 서비스, DTO, 레포지토리, 컨트롤러가 신설 및 개선되었습니다.

Changes

파일/경로 요약 변경 내용 요약
OrderController.java 관리자 주문 조회(GET /admin/orders/{storeId}) 및 상태 변경(PATCH /admin/orders/status/{orderId}) 엔드포인트 구현, Swagger 문서화, 서비스 의존성 추가
OrderService.java (application-admin/.../order/service/) 주문 목록 조회 및 주문 상태 변경 서비스 로직 신설, DTO 변환 및 예외 처리 포함
OrderResponseDto.java, OrderStatusUpdateRequestDto.java, OrderStatusUpdateResponseDto.java 주문 응답, 상태 변경 요청/응답용 DTO 신설, 엔티티→DTO 변환 메서드 포함, 유효성 검사 및 Swagger 문서화 적용
OrderStatus.java (domain-order/.../entity/) 주문 상태(WAITING_FOR_PAYMENT, COOKING, COOKED) Enum 신설, 한글 설명 및 Swagger 문서화
UserOrder.java 주문 상태(OrderStatus), 총 금액(totalPrice) 필드 추가, 상태 변경 메서드 추가, 빌더 기본값 개선
OrderRepository.java 매장별 주문 목록 조회 메서드(findAllByStore_StoreId) 추가
OrderCreateRequestDto.java, OrderCreateResponseDto.java 주문 생성 요청/응답 DTO에 주문 항목(items), 총 금액(totalPrice), 상태(status) 필드 추가, 엔티티→DTO 변환 메서드 수정
OrderService.java (application-user/.../order/service/) 주문 생성 시 상태와 총 금액 초기화 로직 추가(내부 구현 변경)
domain-order/build.gradle SpringDoc OpenAPI UI 의존성 추가
BusinessException.java ErrorMessage import 경로 오타 수정

Sequence Diagram(s)

sequenceDiagram
    participant Admin as AdminClient
    participant Controller as OrderController
    participant Service as OrderService
    participant Repo as OrderRepository
    participant Entity as UserOrder

    Admin->>Controller: GET /admin/orders/{storeId}
    Controller->>Service: findAllOrders(storeId)
    Service->>Repo: findAllByStore_StoreId(storeId)
    Repo-->>Service: List<UserOrder>
    Service->>Controller: List<OrderResponseDto>
    Controller-->>Admin: 200 OK (성공 응답)

    Admin->>Controller: PATCH /admin/orders/status/{orderId}
    Controller->>Service: updateOrderStatus(orderId, newStatus)
    Service->>Repo: findById(orderId)
    Repo-->>Service: UserOrder
    Service->>Entity: updateStatus(newStatus)
    Service-->>Controller: OrderStatusUpdateResponseDto
    Controller-->>Admin: 200 OK (성공 응답)
Loading

Possibly related PRs

  • GTable/NoWait_BE_MultiModule#48: 기존에 OrderController에 미구현 GET 메서드가 추가된 PR로, 이번 PR에서 해당 엔드포인트가 실제 구현 및 확장됨.
    """

📜 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 4d432d3 and 9828345.

📒 Files selected for processing (35)
  • api-user/src/main/java/com/example/apiuser/ApiUserApplication.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/bookmark/controller/BookmarkController.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/bookmark/dto/BookmarkCreateResponse.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/bookmark/dto/BookmarkGetResponse.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/bookmark/service/BookmarkService.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/exception/GlobalExceptionHandler.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/menu/controller/MenuController.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/menu/dto/MenuImageUploadResponse.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/menu/dto/MenuReadDto.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/menu/dto/MenuReadResponse.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/menu/service/MenuService.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/order/controller/OrderController.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/order/dto/CartItemDto.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/order/dto/OrderCreateRequestDto.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/order/dto/OrderCreateResponseDto.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/order/dto/OrderItemListGetResponseDto.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/order/dto/OrderItemResponseDTO.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/order/service/OrderService.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/reservation/controller/ReservationController.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/reservation/dto/ReservationCreateRequestDto.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/reservation/dto/ReservationCreateResponseDto.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/reservation/exception/ReservationNotFoundException.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/reservation/service/ReservationService.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/store/controller/StoreController.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/store/dto/StoreImageUploadResponse.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/store/dto/StoreReadDto.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/store/dto/StoreReadResponse.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/store/service/StoreService.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/store/service/StoreServiceImpl.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/token/controller/TokenController.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/token/dto/AuthenticationResponse.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/token/dto/RefreshTokenRequest.java (0 hunks)
  • api-user/src/main/java/com/example/apiuser/token/service/TokenService.java (0 hunks)
  • application-user/src/main/java/com/nowait/applicationuser/order/dto/OrderCreateRequestDto.java (2 hunks)
  • domain-order/src/main/java/com/nowait/order/entity/UserOrder.java (2 hunks)
💤 Files with no reviewable changes (33)
  • api-user/src/main/java/com/example/apiuser/bookmark/dto/BookmarkGetResponse.java
  • api-user/src/main/java/com/example/apiuser/order/dto/CartItemDto.java
  • api-user/src/main/java/com/example/apiuser/bookmark/controller/BookmarkController.java
  • api-user/src/main/java/com/example/apiuser/store/dto/StoreImageUploadResponse.java
  • api-user/src/main/java/com/example/apiuser/reservation/exception/ReservationNotFoundException.java
  • api-user/src/main/java/com/example/apiuser/menu/dto/MenuReadDto.java
  • api-user/src/main/java/com/example/apiuser/ApiUserApplication.java
  • api-user/src/main/java/com/example/apiuser/order/dto/OrderItemListGetResponseDto.java
  • api-user/src/main/java/com/example/apiuser/token/dto/RefreshTokenRequest.java
  • api-user/src/main/java/com/example/apiuser/reservation/dto/ReservationCreateRequestDto.java
  • api-user/src/main/java/com/example/apiuser/order/dto/OrderCreateResponseDto.java
  • api-user/src/main/java/com/example/apiuser/store/service/StoreService.java
  • api-user/src/main/java/com/example/apiuser/store/controller/StoreController.java
  • api-user/src/main/java/com/example/apiuser/menu/dto/MenuReadResponse.java
  • api-user/src/main/java/com/example/apiuser/menu/controller/MenuController.java
  • api-user/src/main/java/com/example/apiuser/token/service/TokenService.java
  • api-user/src/main/java/com/example/apiuser/order/dto/OrderItemResponseDTO.java
  • api-user/src/main/java/com/example/apiuser/bookmark/service/BookmarkService.java
  • api-user/src/main/java/com/example/apiuser/reservation/dto/ReservationCreateResponseDto.java
  • api-user/src/main/java/com/example/apiuser/bookmark/dto/BookmarkCreateResponse.java
  • api-user/src/main/java/com/example/apiuser/menu/dto/MenuImageUploadResponse.java
  • api-user/src/main/java/com/example/apiuser/menu/service/MenuService.java
  • api-user/src/main/java/com/example/apiuser/store/service/StoreServiceImpl.java
  • api-user/src/main/java/com/example/apiuser/token/controller/TokenController.java
  • api-user/src/main/java/com/example/apiuser/store/dto/StoreReadDto.java
  • api-user/src/main/java/com/example/apiuser/order/dto/OrderCreateRequestDto.java
  • api-user/src/main/java/com/example/apiuser/token/dto/AuthenticationResponse.java
  • api-user/src/main/java/com/example/apiuser/store/dto/StoreReadResponse.java
  • api-user/src/main/java/com/example/apiuser/reservation/service/ReservationService.java
  • api-user/src/main/java/com/example/apiuser/reservation/controller/ReservationController.java
  • api-user/src/main/java/com/example/apiuser/order/service/OrderService.java
  • api-user/src/main/java/com/example/apiuser/order/controller/OrderController.java
  • api-user/src/main/java/com/example/apiuser/exception/GlobalExceptionHandler.java
🚧 Files skipped from review as they are similar to previous changes (2)
  • domain-order/src/main/java/com/nowait/order/entity/UserOrder.java
  • application-user/src/main/java/com/nowait/applicationuser/order/dto/OrderCreateRequestDto.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 3, 2025 10:58
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: 5

🧹 Nitpick comments (4)
application-admin/src/main/java/com/nowait/applicationadmin/order/controller/OrderController.java (2)

35-36: API 문서 설명에 오타가 있습니다.

설명에 두 가지 문제가 있습니다:

  1. "예약리스트"가 아닌 "주문리스트"로 수정이 필요합니다
  2. "주리스트 조회"에서 "문"자가 누락되었습니다
-    @Operation(summary = "주점별 주문리스트 조회", description = "특정 주점에 대한 예약리스트 조회")
-    @ApiResponse(responseCode = "200", description = "주리스트 조회")
+    @Operation(summary = "주점별 주문리스트 조회", description = "특정 주점에 대한 주문리스트 조회")
+    @ApiResponse(responseCode = "200", description = "주문리스트 조회")

54-54: 어노테이션 사이 공백 추가가 필요합니다.

가독성 향상을 위해 @RequestBody@Valid 어노테이션 사이에 공백을 추가하세요.

-        @RequestBody@Valid OrderStatusUpdateRequestDto requestDto
+        @RequestBody @Valid OrderStatusUpdateRequestDto requestDto
application-admin/src/main/java/com/nowait/applicationadmin/order/service/OrderService.java (2)

23-28: 조회 메소드 구현이 적절합니다.

@transactional(readOnly = true) 사용이 적절하며, 스트림을 통한 DTO 변환도 깔끔합니다. 다만 Java 16 이상을 사용한다면 더 간결한 구현이 가능합니다.

-                .collect(Collectors.toList());
+                .toList();

24-24: storeId 유효성 검증을 고려해보세요.

현재 유효하지 않은 storeId가 전달되어도 빈 리스트가 반환됩니다. 비즈니스 로직에 따라 storeId 존재 여부를 검증하는 것을 고려해보세요.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cfc6cc8 and 4d432d3.

📒 Files selected for processing (13)
  • application-admin/src/main/java/com/nowait/applicationadmin/order/controller/OrderController.java (1 hunks)
  • application-admin/src/main/java/com/nowait/applicationadmin/order/dto/OrderResponseDto.java (1 hunks)
  • application-admin/src/main/java/com/nowait/applicationadmin/order/dto/OrderStatusUpdateRequestDto.java (1 hunks)
  • application-admin/src/main/java/com/nowait/applicationadmin/order/dto/OrderStatusUpdateResponseDto.java (1 hunks)
  • application-admin/src/main/java/com/nowait/applicationadmin/order/service/OrderService.java (1 hunks)
  • application-user/src/main/java/com/nowait/applicationuser/order/dto/OrderCreateRequestDto.java (1 hunks)
  • application-user/src/main/java/com/nowait/applicationuser/order/dto/OrderCreateResponseDto.java (3 hunks)
  • application-user/src/main/java/com/nowait/applicationuser/order/service/OrderService.java (2 hunks)
  • domain-order/build.gradle (1 hunks)
  • domain-order/src/main/java/com/nowait/order/entity/OrderStatus.java (1 hunks)
  • domain-order/src/main/java/com/nowait/order/entity/UserOrder.java (2 hunks)
  • domain-order/src/main/java/com/nowait/order/repository/OrderRepository.java (1 hunks)
  • domain-token/src/main/java/com/example/domaintoken/exception/BusinessException.java (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
application-admin/src/main/java/com/nowait/applicationadmin/order/controller/OrderController.java (2)
common/src/main/java/com/nowait/common/api/ApiUtils.java (1)
  • ApiUtils (6-18)
application-user/src/main/java/com/nowait/applicationuser/order/controller/OrderController.java (1)
  • Tag (27-68)
🔇 Additional comments (14)
domain-order/src/main/java/com/nowait/order/repository/OrderRepository.java (1)

16-16: 메서드 추가 확인 완료

관리자 주문 조회 기능을 위한 레포지토리 메서드가 올바르게 추가되었습니다. Spring Data JPA 네이밍 규칙을 준수하고 있으며, 메서드 시그니처가 적절합니다.

application-user/src/main/java/com/nowait/applicationuser/order/service/OrderService.java (1)

18-18: Import 추가 확인 완료

OrderStatus enum 사용을 위한 import가 올바르게 추가되었습니다.

application-admin/src/main/java/com/nowait/applicationadmin/order/dto/OrderStatusUpdateResponseDto.java (1)

1-17: Response DTO 구현이 올바르게 되어 있습니다.

정적 팩토리 메서드 패턴을 사용하여 불변 객체로 설계되었으며, 코드 구조가 간결하고 명확합니다. Lombok 어노테이션 사용도 적절합니다.

application-admin/src/main/java/com/nowait/applicationadmin/order/dto/OrderStatusUpdateRequestDto.java (1)

1-16: Request DTO 구현이 우수합니다.

Jakarta Validation과 Swagger 어노테이션을 적절히 사용하여 검증 로직과 API 문서화를 제공하고 있습니다. 불변 객체로 설계되어 있으며, 허용 가능한 값들을 명시적으로 문서화한 것도 좋습니다.

application-user/src/main/java/com/nowait/applicationuser/order/dto/OrderCreateResponseDto.java (1)

5-5: 주문 상태 및 총액 필드 추가 구현이 적절합니다.

새로 추가된 statustotalPrice 필드가 적절히 구현되었습니다. 임포트, 필드 선언, 그리고 팩토리 메서드에서의 매핑이 모두 일관성 있게 처리되었습니다.

Also applies to: 22-23, 33-34

domain-order/src/main/java/com/nowait/order/entity/OrderStatus.java (1)

1-22: 주문 상태 Enum 구현이 우수합니다.

주문 상태의 흐름(입금대기 → 조리중 → 조리완료)이 비즈니스 로직에 부합하며, Swagger 어노테이션을 통한 API 문서화도 적절히 처리되었습니다. 한국어 설명도 명확하게 작성되었습니다.

application-admin/src/main/java/com/nowait/applicationadmin/order/dto/OrderResponseDto.java (1)

1-33: 관리자용 주문 응답 DTO 구현이 적절합니다.

관리자가 주문을 관리하는 데 필요한 모든 필드(주문 ID, 테이블 ID, 예약자 이름, 총액, 상태, 생성일시)가 포함되어 있으며, 팩토리 메서드를 통한 엔티티 변환 로직도 정확하게 구현되었습니다.

domain-order/src/main/java/com/nowait/order/entity/UserOrder.java (3)

48-48: orderItems 필드의 기본값 설정이 적절합니다.

@Builder.Default 어노테이션을 통해 빌더 패턴 사용 시 빈 리스트로 초기화되도록 한 것이 좋습니다. 이는 NPE를 방지하는 데 도움이 됩니다.


55-57: 주문 상태 필드 구현이 우수합니다.

기본값을 WAITING_FOR_PAYMENT로 설정하여 주문 생성 시 적절한 초기 상태를 보장하고, @Enumerated(EnumType.STRING)을 사용하여 데이터베이스에 문자열로 저장하는 것이 좋습니다.


61-63: 주문 상태 업데이트 메서드 구현이 적절합니다.

간단하고 명확한 상태 업데이트 메서드입니다. 필요에 따라 향후 상태 변경 검증 로직을 추가할 수 있습니다.

application-admin/src/main/java/com/nowait/applicationadmin/order/controller/OrderController.java (3)

28-28: URL 매핑 수정이 잘 되었습니다.

이중 슬래시 오류를 수정하여 올바른 URL 매핑을 구현했습니다.


37-46: 엔드포인트 구현이 잘 되었습니다.

HTTP 상태 코드 사용과 ApiUtils를 통한 일관된 응답 래핑이 적절합니다.


48-60: 상태 업데이트 엔드포인트가 잘 구현되었습니다.

@Valid 어노테이션을 통한 검증과 적절한 에러 응답 코드 문서화가 포함되어 있습니다.

application-admin/src/main/java/com/nowait/applicationadmin/order/service/OrderService.java (1)

30-36: 상태 업데이트 메소드가 잘 구현되었습니다.

적절한 트랜잭션 처리와 엔티티 미발견 시 예외 처리가 구현되어 있습니다.

Comment on lines +32 to 35

// SWAGGER
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0'
}
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

도메인 모듈에 Swagger 의존성 추가는 계층 원칙 위반 위험

domain-order는 순수 도메인 계층이어야 합니다. 여기서 springdoc-openapi-starter-webmvc-ui(Swagger UI) 의존성을 직접 갖게 되면,

  1. WebMVC 및 UI 관련 라이브러리가 도메인 계층으로 전이됩니다.
  2. 다른 모듈(예: application-*, presentation-*)과의 책임 분리가 흐려집니다.
  3. 테스트·빌드 시 불필요한 transitive dependency 로딩·메모리 사용이 증가합니다.

대안

  1. Swagger 어노테이션이 필요하다면 DTO‧Controller가 위치한 애플리케이션/프레젠테이션 모듈로 옮기고, 도메인에는 compileOnly 수준으로만 두거나 완전히 제거합니다.
  2. @Schema 등이 도메인 엔티티에 붙어 있다면 DTO로 옮겨 계층 간 순수성을 유지하세요.

다음 스크립트로 도메인 모듈 내부의 Swagger 어노테이션 사용 여부를 점검해 보세요:


🏁 Script executed:

#!/bin/bash
# domain-order 모듈에서 Swagger 어노테이션(@Schema 등) 사용 검색
fd --extension java domain-order | xargs rg -n "@Schema"

Length of output: 3027


도메인 계층에서 Swagger 의존성 및 애노테이션 제거 필요

도메인 모듈(domain-order)에서 springdoc-openapi-starter-webmvc-ui 의존성과 @Schema 애노테이션 사용이 확인되었습니다. 순수 도메인 계층을 유지하려면 아래를 조치하세요.

• domain-order/build.gradle

  • implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0' 삭제
domain-order/build.gradle
-    implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0'

• domain-order/src/main/java/com/nowait/order/entity/OrderStatus.java

  • 모든 @Schema(...) 애노테이션 제거
  • API 스펙 설명은 DTO/프레젠테이션 계층(예: application-admin 모듈의 DTO)으로 이동

• 필요 시, DTO에서만 Swagger 의존성을 compileOnly 또는 implementation 으로 선언해 사용

🤖 Prompt for AI Agents
In domain-order/build.gradle lines 32 to 35, remove the dependency
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0' to
eliminate Swagger from the domain layer. Then, in
domain-order/src/main/java/com/nowait/order/entity/OrderStatus.java, delete all
@Schema annotations to keep the domain model pure. Move any API specification
descriptions to the DTO or presentation layer, such as the application-admin
module. If Swagger is needed in DTOs, add the dependency there with compileOnly
or implementation scope.

package com.example.domaintoken.exception;

import com.nowaiting.common.exception.ErrorMessage;
import com.nowait.common.exception.ErrorMessage;
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

패키지 명칭 변경의 일관성을 확인해주세요.

패키지 명칭이 nowaiting에서 nowait으로 변경되었습니다. 프로젝트 전반에서 이러한 패키지 명칭 변경이 일관되게 적용되었는지 확인이 필요합니다.

다음 스크립트를 실행하여 프로젝트 전반의 패키지 명칭 일관성을 확인해주세요:


🏁 Script executed:

#!/bin/bash
# 기존 nowaiting 패키지 참조가 남아있는지 확인
rg -n "nowaiting" --type java

# nowait 패키지 사용 현황 확인
rg -n "nowait" --type java -A 2 -B 2

Length of output: 176557


패키지 명칭 통일화 필요: com.nowaiting → com.nowait

프로젝트 전반에서 아직 com.nowaiting 패키지 참조가 다수 남아 있습니다. 단일화된 com.nowait 패키지로 일괄 변경해주세요. 예를 들어 아래 위치들을 포함한 모든 모듈에서 수정이 필요합니다.

  • api-user/src/main/java/com/example/apiuser/order/controller/OrderController.java
    import com.nowaiting.common.api.ApiUtils;
  • api-user/src/main/java/com/example/apiuser/reservation/service/ReservationService.java
    import com.nowaiting.common.enums.ReservationStatus;
    import com.nowaiting.user.entity.User; 등
  • api-user/src/main/java/com/example/apiuser/exception/GlobalExceptionHandler.java
    import static com.nowaiting.common.exception.ErrorMessage.*;
  • application-user/src/main/java/com/nowait/applicationuser/ApiUserApplication.java
    scanBasePackages·EntityScan·EnableJpaRepositories 설정에 "com.nowaiting.user.entity"
  • domain-bookmark, domain-store, domain-menu, domain-reservation, domain-order 등 각 도메인 모듈
  • security-front, security-admin, external-oauth, application-admin 등 여러 모듈

변경 후 rg -n "com.nowaiting" 명령으로 누락된 참조가 없는지 반드시 검증해주세요.

🤖 Prompt for AI Agents
In
domain-token/src/main/java/com/example/domaintoken/exception/BusinessException.java
at line 3, the import statement references the package com.nowaiting, which
should be updated to com.nowait to unify package naming across the project.
Change all occurrences of com.nowaiting to com.nowait in this file and ensure to
apply the same update consistently across all modules and files mentioned in the
comment. After making these changes, run the command rg -n "com.nowaiting" to
verify no references to the old package name remain.

Comment on lines +60 to +62
.status(OrderStatus.WAITING_FOR_PAYMENT)
.totalPrice(orderCreateRequestDto.getTotalPrice())

Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

주문 총 금액 검증 로직 추가를 고려해주세요.

주문 생성 시 상태를 WAITING_FOR_PAYMENT로 초기화하는 것은 적절합니다. 하지만 totalPrice를 클라이언트에서 전달받은 값을 그대로 사용하고 있는데, 이는 보안상 위험할 수 있습니다.

다음과 같이 서버 측에서 총 금액을 계산하여 검증하는 로직을 추가하는 것을 권장합니다:

// 2. UserOrder 생성 및 signature 저장
+ // 총 금액 계산 및 검증
+ int calculatedTotalPrice = orderCreateRequestDto.getItems().stream()
+     .mapToInt(item -> {
+         Menu menu = menuMap.get(item.getMenuId());
+         return menu.getPrice() * item.getQuantity();
+     })
+     .sum();
+ 
+ if (calculatedTotalPrice != orderCreateRequestDto.getTotalPrice()) {
+     throw new IllegalArgumentException("총 금액이 일치하지 않습니다");
+ }

UserOrder order = UserOrder.builder()
    .tableId(tableId)
    .store(store)
    .signature(signature)
    .sessionId(sessionId)
    .depositorName(orderCreateRequestDto.getDepositorName())
    .status(OrderStatus.WAITING_FOR_PAYMENT)
-   .totalPrice(orderCreateRequestDto.getTotalPrice())
+   .totalPrice(calculatedTotalPrice)
    .build();
📝 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
.status(OrderStatus.WAITING_FOR_PAYMENT)
.totalPrice(orderCreateRequestDto.getTotalPrice())
// 2. UserOrder 생성 및 signature 저장
// 총 금액 계산 및 검증
int calculatedTotalPrice = orderCreateRequestDto.getItems().stream()
.mapToInt(item -> {
Menu menu = menuMap.get(item.getMenuId());
return menu.getPrice() * item.getQuantity();
})
.sum();
if (calculatedTotalPrice != orderCreateRequestDto.getTotalPrice()) {
throw new IllegalArgumentException("총 금액이 일치하지 않습니다");
}
UserOrder order = UserOrder.builder()
.tableId(tableId)
.store(store)
.signature(signature)
.sessionId(sessionId)
.depositorName(orderCreateRequestDto.getDepositorName())
.status(OrderStatus.WAITING_FOR_PAYMENT)
.totalPrice(calculatedTotalPrice)
.build();
🤖 Prompt for AI Agents
In
application-user/src/main/java/com/nowait/applicationuser/order/service/OrderService.java
around lines 60 to 62, the totalPrice is set directly from the client request
without validation, which poses a security risk. To fix this, implement
server-side logic to calculate the total price based on the order details (e.g.,
item prices and quantities) and compare it with the client-provided totalPrice.
Use the server-calculated total price for setting the order's totalPrice to
ensure data integrity and prevent tampering.

Comment on lines 18 to 21
@NotBlank(message = "주문 내역은 필수입니다")
private final List<CartItemDto> items; // 장바구니 항목 리스트
@NotBlank(message = "주문금액은 필수 입니다.")
private final int totalPrice;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

검증 어노테이션 및 데이터 타입 수정이 필요합니다.

다음과 같은 문제들이 있습니다:

  1. @NotBlank는 문자열 타입에만 사용해야 합니다. List<CartItemDto>에는 @NotEmpty를 사용해야 합니다.
  2. int totalPrice에는 @NotBlank 대신 @NotNull@Positive를 사용해야 합니다.
  3. 다른 클래스에서는 Integer를 사용하는데 여기서는 int를 사용하여 일관성이 없습니다.

다음과 같이 수정하세요:

-	@NotBlank(message = "주문 내역은 필수입니다")
+	@NotEmpty(message = "주문 내역은 필수입니다")
	private final List<CartItemDto> items; // 장바구니 항목 리스트
-	@NotBlank(message = "주문금액은 필수 입니다.")
-	private final int totalPrice;
+	@NotNull(message = "주문금액은 필수입니다")
+	@Positive(message = "주문금액은 양수여야 합니다")
+	private final Integer totalPrice;

추가적으로 @Positive 어노테이션을 사용하기 위해 import에 jakarta.validation.constraints.Positive를 추가하세요.

🤖 Prompt for AI Agents
In
application-user/src/main/java/com/nowait/applicationuser/order/dto/OrderCreateRequestDto.java
around lines 18 to 21, replace the @NotBlank annotation on the List<CartItemDto>
items field with @NotEmpty to correctly validate non-empty collections. For the
totalPrice field, change its type from primitive int to Integer for consistency
with other classes, and replace @NotBlank with @NotNull and @Positive
annotations to ensure it is a positive number. Also, add the import statement
for jakarta.validation.constraints.Positive to support the new annotation.

- 기존 삭제된 디렉토리가 중복 등장 / 삭제처리
@HyemIin HyemIin merged commit acce3f9 into develop Jul 3, 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