Conversation
WalkthroughRemoves ItemStock field and stock-management logic from the point shop item domain across entities, services, DTOs, controllers, and projections. Additionally updates WeeklyRankingScheduler cron expression from Thursday 17:23 to Monday 00:00. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
Unit Test Coverage Report
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/main/java/com/example/green/domain/pointshop/item/controller/PointItemAdminController.java (1)
81-86: Controller mapping now correctly omits stock; consider mirroring create-path patternThe
PointItemUpdateCommandconstruction withItemPrice(updatePointItemRequest.price())is consistent with the new 4‑arg command signature and stock removal.Optionally, for symmetry with
CreatePointItemRequest.toCommand(), you could move this VO construction into anUpdatePointItemRequest.toCommand()to keep mapping logic out of the controller.src/test/java/com/example/green/domain/pointshop/item/service/PointItemServiceTest.java (1)
200-215: Check BigDecimal scale consistency between helper and assertion
getCreateItemCommand()now builds the price withnew ItemPrice(BigDecimal.valueOf(1200)), while the test assertion at Line 59 compares againstnew BigDecimal("1200.00"). Whether this passes depends on howItemPricenormalizes scale internally and on how equality is implemented.To avoid subtle failures, consider aligning both sides (e.g., same
BigDecimalconstruction or using AssertJ’sisEqualByComparingTo("1200.00")) so the scale expectation is explicit.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (19)
src/main/java/com/example/green/domain/dashboard/rankingmodule/service/WeeklyRankingScheduler.java(1 hunks)src/main/java/com/example/green/domain/pointshop/item/controller/PointItemAdminController.java(1 hunks)src/main/java/com/example/green/domain/pointshop/item/dto/request/CreatePointItemRequest.java(1 hunks)src/main/java/com/example/green/domain/pointshop/item/dto/request/UpdatePointItemRequest.java(1 hunks)src/main/java/com/example/green/domain/pointshop/item/dto/response/PointItemClientResponse.java(2 hunks)src/main/java/com/example/green/domain/pointshop/item/entity/PointItem.java(1 hunks)src/main/java/com/example/green/domain/pointshop/item/excel/PointItemExcelMapper.java(0 hunks)src/main/java/com/example/green/domain/pointshop/item/infra/PointItemProjections.java(0 hunks)src/main/java/com/example/green/domain/pointshop/item/infra/PointItemQueryExecutor.java(1 hunks)src/main/java/com/example/green/domain/pointshop/item/service/PointItemOrderService.java(0 hunks)src/main/java/com/example/green/domain/pointshop/item/service/PointItemService.java(1 hunks)src/main/java/com/example/green/domain/pointshop/item/service/command/PointItemCreateCommand.java(1 hunks)src/main/java/com/example/green/domain/pointshop/item/service/command/PointItemUpdateCommand.java(1 hunks)src/main/resources/db/migration/v13__migrate_point_item.sql(1 hunks)src/test/java/com/example/green/domain/pointshop/item/controller/DummyData.java(2 hunks)src/test/java/com/example/green/domain/pointshop/item/controller/PointItemOrderServiceControllerTest.java(1 hunks)src/test/java/com/example/green/domain/pointshop/item/service/PointItemOrderServiceTest.java(0 hunks)src/test/java/com/example/green/domain/pointshop/item/service/PointItemQueryServiceTest.java(1 hunks)src/test/java/com/example/green/domain/pointshop/item/service/PointItemServiceTest.java(4 hunks)
💤 Files with no reviewable changes (4)
- src/test/java/com/example/green/domain/pointshop/item/service/PointItemOrderServiceTest.java
- src/main/java/com/example/green/domain/pointshop/item/service/PointItemOrderService.java
- src/main/java/com/example/green/domain/pointshop/item/excel/PointItemExcelMapper.java
- src/main/java/com/example/green/domain/pointshop/item/infra/PointItemProjections.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: check
🔇 Additional comments (14)
src/main/java/com/example/green/domain/dashboard/rankingmodule/service/WeeklyRankingScheduler.java (1)
23-23: Cron 변경이 주석/로직과 일치합니다
@Scheduled(cron = "0 0 0 * * MON", zone = "Asia/Seoul")은 매주 월요일 00:00 실행이고, 내부에서today.minusWeeks(1)기준 월~일까지 계산하므로 “지난 주 랭킹 계산” 요구사항과 잘 맞습니다.src/main/java/com/example/green/domain/pointshop/item/service/PointItemService.java (1)
30-37: PointItem 생성 시 재고 제거가 일관되게 반영되어 있습니다
PointItem.create인자가itemCode/info/media/price로만 축소되어 서비스 계층에서도 재고 책임이 제거되었습니다. 업데이트 로직과도 시그니처가 일치해 보입니다.src/main/java/com/example/green/domain/pointshop/item/service/command/PointItemUpdateCommand.java (1)
8-13: Update 커맨드에서 재고 제거 시그니처 정리 OK
PointItemUpdateCommand가 4개 필드만 가지도록 단순화되어 서비스/컨트롤러에서 재고 인자를 전달하지 않아도 되도록 잘 정리됐습니다.src/main/java/com/example/green/domain/pointshop/item/infra/PointItemQueryExecutor.java (1)
52-60: 커서 조회 응답에서 재고/판매상태 제거 일관성 확보
findItemByCursor가 이제PointItemResponse에 id/이름/썸네일/가격만 전달하므로, 외부 검색/목록 API에서 재고·판매상태를 숨기겠다는 방향성과 잘 맞습니다.PointItemResponse생성자 시그니처만 현재 코드와 맞는지만 빌드 시 한 번 더 확인하면 될 것 같습니다.src/main/resources/db/migration/v13__migrate_point_item.sql (1)
1-9: 스키마에서 selling_status/stock 제거가 코드 변경과 정합적입니다
point_item테이블에서selling_status,stock를DROP COLUMN IF EXISTS로 제거해 기존 데이터/코드 정리 방향과 잘 맞습니다. 다른 인덱스나 제약조건에서 이 컬럼들을 참조하지 않는지만 한 번 더 점검하면 운영 배포 시 위험을 줄일 수 있습니다.src/main/java/com/example/green/domain/pointshop/item/dto/request/CreatePointItemRequest.java (1)
35-45: 생성 요청 DTO에서 재고 제거 및 매핑 정리 완료
CreatePointItemRequest가price만 보유하고toCommand에서ItemPrice만 생성하도록 정리되어, 커맨드/엔티티 레벨의 재고 제거와 잘 맞습니다. 추가적인 가격 검증(예: 0 이상)은 별도 정책으로 필요 시 이후에만 고려하면 될 것 같습니다.src/test/java/com/example/green/domain/pointshop/item/controller/PointItemOrderServiceControllerTest.java (1)
49-55: 테스트에서 PointItem 생성자 시그니처 변경 반영 OK컨트롤러 테스트가
new PointItem(itemCode, itemBasicInfo, itemMedia, itemPrice)로 재고 없이 생성하도록 수정되어, 엔티티 생성자 변경과 일관됩니다. 주문 플로우에 대한 기존 검증 로직도 그대로 유지됩니다.src/test/java/com/example/green/domain/pointshop/item/controller/DummyData.java (1)
10-27: Dummy 데이터가 새로운 DTO 시그니처와 일치합니다
CreatePointItemRequest/UpdatePointItemRequest를 5개 인자(코드/이름/설명/썸네일/가격)로만 생성하도록 수정해 테스트 픽스처도 재고 제거 정책과 정합성을 유지하고 있습니다.src/test/java/com/example/green/domain/pointshop/item/service/PointItemQueryServiceTest.java (1)
72-86: Updated PointItem instantiation correctly follows new 4-arg constructorThe spy construction now matches the updated
PointItemsignature (code/basicInfo/media/price only); assertions remain valid and no stock-related assumptions linger in this test.src/main/java/com/example/green/domain/pointshop/item/dto/request/UpdatePointItemRequest.java (1)
31-34: UpdatePointItemRequest DTO shape is consistent with stock removal
priceremains required and documented while stock is gone from the record, matching the domain and controller changes.src/main/java/com/example/green/domain/pointshop/item/service/command/PointItemCreateCommand.java (1)
8-13: PointItemCreateCommand now matches PointItem factory signatureThe record fields (code/info/media/price) align with the updated
PointItem.createAPI and the removal of stock from the domain.src/test/java/com/example/green/domain/pointshop/item/service/PointItemServiceTest.java (1)
79-107: Service tests’ PointItem setup correctly adapted to 4-arg constructorBoth modification tests now build
PointItemwithItemPriceonly (no stock), matching the new entity constructor while keeping the existing behavior checks intact.src/main/java/com/example/green/domain/pointshop/item/dto/response/PointItemClientResponse.java (1)
40-76: Client response DTO cleanly updated to remove stockThe constructor and
fromfactory now exclude stock and only validate/assign price and point fields, which matches the newPointItemsurface and keeps DTO validation coherent.src/main/java/com/example/green/domain/pointshop/item/entity/PointItem.java (1)
64-86: PointItem constructor and factory correctly simplified to price-only, preserving invariantsThe builder constructor,
createfactory, andvalidatePointItemnow consistently require only code/basicInfo/media/price and still enforce non-null checks while defaultingdisplayStatustoDISPLAY. This cleanly reflects the removal of stock/selling status without weakening basic domain validation.
#️⃣ 연관된 이슈
📝 작업 내용
📷 스크린샷
💬 리뷰 요구사항(선택)
📌 PR 진행 시 참고사항
P1: 꼭 반영해 주세요 (Request Changes) – 이슈나 취약점 관련P2: 반영을 고려해 주세요 (Comment) – 개선 의견P3: 단순 제안 (Chore)Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.