-
Notifications
You must be signed in to change notification settings - Fork 0
cartItemDto에_menuId_추가하여_반환 : feat : cartItemDto에 menuId칼럼추가 https://github.com/CampusTable/campus-table-be/issues/60 #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The head ref may contain hidden characters: "20251231_#60_cartItemDto\uC5D0_menuId_\uCD94\uAC00\uD558\uC5EC_\uBC18\uD658"
Conversation
개요CartItemDto에 메뉴 ID 필드를 추가하고 엔티티의 메뉴 정보에서 이를 초기화합니다. 변경사항
예상 코드 리뷰 소요 시간🎯 2 (Simple) | ⏱️ ~10분 관련 가능 이슈
시
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/main/java/com/campustable/be/domain/cart/dto/CartItemDto.java
🔇 Additional comments (1)
src/main/java/com/campustable/be/domain/cart/dto/CartItemDto.java (1)
16-16: 필드 추가가 적절합니다.PR 목표에 맞게
menuId필드가 올바르게 추가되었습니다.
| public CartItemDto(CartItem entity) { | ||
| this.menuName = entity.getMenu().getMenuName(); | ||
| this.price = entity.getMenu().getPrice(); | ||
| this.quantity = entity.getQuantity(); | ||
| this.menuUrl = entity.getMenu().getMenuUrl(); | ||
| this.cartItemId = entity.getCartItemId(); | ||
| this.menuId = entity.getMenu().getId(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
# Find CartItem entity
fd -e java CartItem | head -20Repository: CampusTable/campus-table-be
Length of output: 282
🏁 Script executed:
# Search for CartItem class definition and menu field
rg "class CartItem" -A 20 --type javaRepository: CampusTable/campus-table-be
Length of output: 3509
🏁 Script executed:
# Look for menu field definition with annotations
rg "@(NotNull|NonNull|Column|ManyToOne)" -B 2 -A 2 "menu" --type java -iRepository: CampusTable/campus-table-be
Length of output: 115
🏁 Script executed:
# Check for any null handling patterns in the codebase for similar constructors
rg -B 2 -A 5 "public.*Dto.*\(.*entity\)" --type java | head -100Repository: CampusTable/campus-table-be
Length of output: 899
🏁 Script executed:
# Check if there are other DTOs with similar constructors and how they handle potential nulls
rg "public.*Dto\(.*entity\)" -A 10 --type java | grep -A 10 "getMenu\|getNot\|isNull"Repository: CampusTable/campus-table-be
Length of output: 885
🏁 Script executed:
# Check CartItem entity for full field definitions including validation
cat -n src/main/java/com/campustable/be/domain/cart/entity/CartItem.javaRepository: CampusTable/campus-table-be
Length of output: 1326
🏁 Script executed:
# Look for any validation or null checks in CartItem usage (services, controllers)
rg "new CartItemDto" -B 3 -A 3 --type javaRepository: CampusTable/campus-table-be
Length of output: 53
entity.getMenu() 호출 시 NullPointerException 위험을 해결하세요.
CartItem 엔티티의 menu 필드는 @ManyToOne(fetch = FetchType.LAZY) 애노테이션만 있고, @NotNull 등의 제약조건이 없어 null이 될 수 있습니다. 그러나 CartItemDto 생성자는 19, 20, 22, 24번 라인에서 null 체크 없이 entity.getMenu()를 호출하고 있어 menu가 null일 경우 런타임에 NullPointerException이 발생합니다.
null 체크를 추가하거나, menu 필드에 @NotNull 제약조건을 추가하여 데이터 무결성을 보장해야 합니다.
✨ 변경 사항
cartItemDto에_menuId_추가하여_반환 : feat : cartItemDto에 menuId칼럼추가 #60
✅ 테스트
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.