refactor: 입고 및 입고 품목에서 무게나 박스에 관련된 부분 삭제#150
Conversation
둘러보기이 PR은 Receipt 및 ReceiptItem 도메인에서 박스 수량 및 무게 관련 필드를 제거하고, 관련 DTO와 서비스 호출 시그니처를 단순화하며 테스트들을 이에 맞게 조정합니다. 제거된 필드: 변경 사항
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
추천 참조: JPA 필드 제거 시점의 마이그레이션 가이드(예: Flyway/DDL 변경), Java record/DTO 변경 관련 호환성 문서. Possibly related PRs
제안 라벨
시
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (7)
💤 Files with no reviewable changes (4)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used🧠 Learnings (2)📚 Learning: 2025-11-20T10:43:47.502ZApplied to files:
📚 Learning: 2025-11-22T18:12:13.172ZApplied to files:
🔇 Additional comments (6)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/test/java/com/almang/inventory/receipt/service/ReceiptServiceTest.java (1)
687-688: 사용하지 않는 변수 제거 필요
newTotalWeight변수가 선언되었지만 사용되지 않습니다. 무게 관련 로직 제거 과정에서 남은 잔여 코드로 보입니다. 테스트 코드의 명확성을 위해 제거해 주세요.- BigDecimal newTotalWeight = BigDecimal.valueOf(123.456); - UpdateReceiptRequest request = new UpdateReceiptRequest(
🧹 Nitpick comments (1)
src/main/java/com/almang/inventory/receipt/domain/Receipt.java (1)
14-14: 사용하지 않는 import 발견
org.springframework.security.core.parameters.P는 현재 파일에서 사용되지 않는 것으로 보입니다. 리팩토링 과정에서 남은 잔여물로 추정됩니다. 코드 정리 차원에서 제거를 권장합니다.-import org.springframework.security.core.parameters.P;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
src/main/java/com/almang/inventory/receipt/domain/Receipt.java(1 hunks)src/main/java/com/almang/inventory/receipt/domain/ReceiptItem.java(0 hunks)src/main/java/com/almang/inventory/receipt/dto/request/UpdateReceiptItemRequest.java(0 hunks)src/main/java/com/almang/inventory/receipt/dto/request/UpdateReceiptRequest.java(0 hunks)src/main/java/com/almang/inventory/receipt/dto/response/ReceiptItemResponse.java(0 hunks)src/main/java/com/almang/inventory/receipt/dto/response/ReceiptResponse.java(0 hunks)src/main/java/com/almang/inventory/receipt/service/ReceiptService.java(1 hunks)src/test/java/com/almang/inventory/receipt/controller/ReceiptControllerTest.java(1 hunks)src/test/java/com/almang/inventory/receipt/service/ReceiptServiceTest.java(6 hunks)
💤 Files with no reviewable changes (5)
- src/main/java/com/almang/inventory/receipt/dto/request/UpdateReceiptRequest.java
- src/main/java/com/almang/inventory/receipt/dto/request/UpdateReceiptItemRequest.java
- src/main/java/com/almang/inventory/receipt/domain/ReceiptItem.java
- src/main/java/com/almang/inventory/receipt/dto/response/ReceiptResponse.java
- src/main/java/com/almang/inventory/receipt/dto/response/ReceiptItemResponse.java
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-11-20T10:43:47.502Z
Learnt from: JoonKyoLee
Repo: almang2/inventory-server PR: 33
File: src/main/java/com/almang/inventory/product/domain/Product.java:62-66
Timestamp: 2025-11-20T10:43:47.502Z
Learning: In the almang2/inventory-server repository, Product entity update methods (e.g., updateVendor in src/main/java/com/almang/inventory/product/domain/Product.java) do not require null checks on vendor parameters because ProductService validates vendor existence via findVendorByIdAndValidateAccess before calling update methods, and the vendor field has nullable=false constraint ensuring this.vendor is never null for persisted entities.
Applied to files:
src/test/java/com/almang/inventory/receipt/service/ReceiptServiceTest.java
📚 Learning: 2025-11-22T18:12:13.172Z
Learnt from: JoonKyoLee
Repo: almang2/inventory-server PR: 66
File: src/main/java/com/almang/inventory/order/domain/OrderItem.java:41-53
Timestamp: 2025-11-22T18:12:13.172Z
Learning: In the almang2/inventory-server repository, OrderItem entity update methods (updateQuantity, updatePrice in src/main/java/com/almang/inventory/order/domain/OrderItem.java) do not require null checks because OrderService will validate parameters before calling these update methods, following the same pattern as Product entity updates.
<!--
Applied to files:
src/test/java/com/almang/inventory/receipt/service/ReceiptServiceTest.javasrc/main/java/com/almang/inventory/receipt/domain/Receipt.javasrc/test/java/com/almang/inventory/receipt/controller/ReceiptControllerTest.javasrc/main/java/com/almang/inventory/receipt/service/ReceiptService.java
🔇 Additional comments (9)
src/main/java/com/almang/inventory/receipt/domain/Receipt.java (1)
56-65: 리팩토링 목표에 부합하는 깔끔한 변경입니다 👍
update메서드에서totalBoxCount와totalWeightG관련 파라미터가 제거되어 PR 목표(입고에서 박스/무게 계산 제거)에 잘 부합합니다. null 체크 패턴도 기존 엔티티 패턴과 일관성을 유지하고 있습니다.src/test/java/com/almang/inventory/receipt/service/ReceiptServiceTest.java (2)
39-39: import 정리 및 일관성 개선 LGTM
java.util.Listimport 추가 후List.of()형태로 통일한 것은 코드 가독성 향상에 좋습니다. 테스트 케이스들이 새로운 DTO 시그니처에 맞게 잘 업데이트되었습니다.Also applies to: 732-732, 753-753, 785-785, 852-852
1154-1154: UpdateReceiptItemRequest 생성자 호출 확인간소화된 DTO 시그니처에 맞게 테스트가 잘 업데이트되었습니다.
boxCount와measuredWeight파라미터가 제거된 새로운 생성자 형태를 올바르게 사용하고 있습니다.src/test/java/com/almang/inventory/receipt/controller/ReceiptControllerTest.java (2)
402-410: DTO 시그니처 변경에 따른 테스트 업데이트 확인
ReceiptItemResponse생성자가 박스/무게 관련 필드 제거에 맞게 올바르게 업데이트되었습니다. 테스트 데이터 구성이 새로운 API 응답 형태와 일치합니다.
65-109: 컨트롤러 테스트 커버리지 유지 확인 👍성공 케이스와 에러 케이스 모두에 대한 테스트가 잘 유지되고 있습니다. Mock 응답 객체들이 간소화된 DTO 구조에 맞게 적절히 업데이트되었으며, JSON 경로 검증도 새로운 응답 형태에 맞습니다.
Also applies to: 183-226, 300-343, 399-451, 487-550, 740-771, 830-874
src/main/java/com/almang/inventory/receipt/service/ReceiptService.java (4)
119-138: 입고 수정 로직 간소화 완료
receipt.update()호출이status와activated만 전달하도록 단순화되었습니다. 무게/박스 재계산 로직이 제거되어 코드 복잡도가 감소했습니다. PR 목표에 부합하는 깔끔한 리팩토링입니다.
195-217: 입고 아이템 수정 메서드 개선
receiptItem.update()호출에서boxCount와measuredWeight파라미터가 제거되었습니다. 이에 따라 총 박스 수 재계산 로직도 불필요해져 전체적인 코드 흐름이 단순해졌습니다.
246-265: 엔티티 생성 메서드 정리 완료
toReceiptEntity와toReceiptItemEntity메서드에서 무게/박스 관련 필드 초기화가 제거되었습니다. 빌더 패턴 사용이 깔끔하며, 필수 필드만 설정하는 명확한 구조입니다.
343-355: updateReceiptItems 헬퍼 메서드 간소화반복문 내
receiptItem.update()호출이 새로운 시그니처에 맞게 업데이트되었습니다. 이전에 존재하던 총 박스 수 재계산 로직이 제거되어 메서드의 책임이 명확해졌습니다.
✨ 작업 내용
📝 적용 범위
/receipt📌 참고 사항
Summary by CodeRabbit
릴리스 노트
리팩토링
테스트
✏️ Tip: You can customize this high-level summary in your review settings.