Skip to content

Conversation

@seojelee9999
Copy link
Contributor

@seojelee9999 seojelee9999 commented Dec 31, 2025

✨ 변경 사항


cartItemDto에_menuId_추가하여_반환 : feat : cartItemDto에 menuId칼럼추가 #60

✅ 테스트


  • 수동 테스트 완료
  • 테스트 코드 완료

Summary by CodeRabbit

  • 새로운 기능
    • 장바구니 항목에 메뉴 ID 정보가 추가되어 메뉴 추적 기능이 개선되었습니다.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 31, 2025

개요

CartItemDto에 메뉴 ID 필드를 추가하고 엔티티의 메뉴 정보에서 이를 초기화합니다.

변경사항

클러스터 / 파일 요약
DTO 필드 추가
src/main/java/com/campustable/be/domain/cart/dto/CartItemDto.java
menuId 필드 추가 (Long 타입) 및 CartItem 엔티티 기반 생성자에서 entity.getMenu().getId()로 초기화

예상 코드 리뷰 소요 시간

🎯 2 (Simple) | ⏱️ ~10분

관련 가능 이슈

🐰 카트에 담긴 메뉴, ID를 달고
정보는 더욱 선명하게 흘러가고
작은 필드 하나가 큰 변화를 만들어
쇼핑 경험이 한층 더 스마트해지는 마법✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목이 변경 사항의 주요 내용을 명확하게 반영하고 있습니다. cartItemDto에 menuId를 추가하는 변경 사항을 정확하게 설명합니다.
✨ 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

Comment @coderabbitai help to get the list of available commands and usage tips.

@seojelee9999 seojelee9999 merged commit 85b9d22 into test Dec 31, 2025
1 of 2 checks passed
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: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 12e078b and ca3e88a.

📒 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 필드가 올바르게 추가되었습니다.

Comment on lines 18 to 25
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();
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# Find CartItem entity
fd -e java CartItem | head -20

Repository: CampusTable/campus-table-be

Length of output: 282


🏁 Script executed:

# Search for CartItem class definition and menu field
rg "class CartItem" -A 20 --type java

Repository: 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 -i

Repository: 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 -100

Repository: 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.java

Repository: 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 java

Repository: 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 제약조건을 추가하여 데이터 무결성을 보장해야 합니다.

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