Skip to content

포인트 아이템 등록시 재고 설정 부분 제외#394

Merged
sanchaehwa merged 2 commits intomainfrom
fix/pointItem
Dec 5, 2025
Merged

포인트 아이템 등록시 재고 설정 부분 제외#394
sanchaehwa merged 2 commits intomainfrom
fix/pointItem

Conversation

@sanchaehwa
Copy link
Member

@sanchaehwa sanchaehwa commented Dec 5, 2025

#️⃣ 연관된 이슈

ex) close #Issue number

📝 작업 내용

이번 PR에서 작업한 내용을 간략히 설명해주세요(이미지 첨부 가능)

📷 스크린샷

이미지

💬 리뷰 요구사항(선택)

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요

ex) 메서드 명칭

📌 PR 진행 시 참고사항

  • 리뷰어는 좋은 코드 방향을 제시하되, 수정을 강요하지 않습니다.
  • 좋은 코드를 발견하면 칭찬과 격려를 아끼지 않습니다.
  • 리뷰는 Reviewer로 지정된 시점 기준으로 3일 이내에 진행해 주세요.
  • Comment 작성 시 아래 Prefix를 사용해 주세요:
    • P1: 꼭 반영해 주세요 (Request Changes) – 이슈나 취약점 관련
    • P2: 반영을 고려해 주세요 (Comment) – 개선 의견
    • P3: 단순 제안 (Chore)

Summary by CodeRabbit

  • Changes
    • Weekly ranking batch execution time updated to Monday at 00:00 (previously Thursday at 17:23)
    • Inventory stock tracking removed from point shop items—items no longer display or manage quantity availability

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 5, 2025

Walkthrough

Removes 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

Cohort / File(s) Change Summary
Scheduling
src/main/java/.../WeeklyRankingScheduler.java
Updated @Scheduled cron expression from 0 23 17 * * THU (Thursday 17:23) to 0 0 0 * * MON (Monday 00:00)
Core Entity
src/main/java/.../PointItem.java
Removed ItemStock and SellingStatus fields; updated constructor and factory method to exclude ItemStock; removed updateItemStock, decreaseStock, and updateSellingStatus methods; simplified validation logic
Request DTOs
src/main/java/.../CreatePointItemRequest.java, UpdatePointItemRequest.java
Removed stock field and related validation annotations from both records; updated toCommand to exclude ItemStock construction
Response DTO
src/main/java/.../PointItemClientResponse.java
Removed stock field, constructor parameter, and validation; updated from(...) factory method signature
Commands
src/main/java/.../PointItemCreateCommand.java, PointItemUpdateCommand.java
Removed ItemStock field from record declarations and constructor signatures
Controller
src/main/java/.../PointItemAdminController.java
Removed ItemStock parameter from PointItemUpdateCommand constructor call; removed ItemStock import
Services
src/main/java/.../PointItemService.java, PointItemOrderService.java
Removed stock handling from PointItem creation; removed decreaseItemStock public method and PointItemService dependency injection from PointItemOrderService
Infrastructure & Query
src/main/java/.../PointItemProjections.java, PointItemQueryExecutor.java, PointItemExcelMapper.java
Removed stockQuantity and sellingStatus projections/fields; removed corresponding columns from Excel export mapping
Database Migration
src/main/resources/db/migration/v13__migrate_point_item.sql
Dropped selling_status and stock columns from point_item table
Test Files
src/test/java/.../DummyData.java, PointItemOrderServiceControllerTest.java, PointItemOrderServiceTest.java, PointItemQueryServiceTest.java, PointItemServiceTest.java
Updated all test data constructors and mocking to remove ItemStock parameters; removed stock-decrease mock setup and related test case (재고가_부족하면_예외발생)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Homogeneous changes: ItemStock removal follows a consistent pattern across many files, reducing review complexity
  • Areas requiring attention:
    • Verify database migration logic and ensure no orphaned references to dropped columns
    • Confirm PointItemOrderService behavior remains correct after removing stock-decrease dependency
    • Validate all constructor signatures updated consistently across production code and tests
    • Check that PointItemProjections and PointItemQueryExecutor projections still return complete required data for downstream consumers

Possibly related PRs

Suggested labels

dev:fix

Suggested reviewers

  • yunjeooong

Poem

🐰 ItemStock hops away, no more to track,
Weekly rankings shift, a Monday comeback,
With nimble paws, the code's refactored right,
Stock fields removed, the domain's light! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.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 The PR title '포인트 아이템 등록시 재고 설정 부분 제외' (Exclude stock setting when registering point items) accurately describes the primary change: removal of stock-related fields and logic across the point item domain.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/pointItem

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.

@github-actions
Copy link

github-actions bot commented Dec 5, 2025

Unit Test Coverage Report

Total Project Coverage 37.44%
File Coverage [73.87%]
PointItemOrderService.java 92.19% 🍏
PointItemService.java 91.04% 🍏
PointItem.java 85.57% 🍏
PointItemAdminController.java 82.08% 🍏
PointItemExcelMapper.java 0%
WeeklyRankingScheduler.java 0%

Copy link
Contributor

@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: 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 pattern

The PointItemUpdateCommand construction with ItemPrice(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 an UpdatePointItemRequest.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 with new ItemPrice(BigDecimal.valueOf(1200)), while the test assertion at Line 59 compares against new BigDecimal("1200.00"). Whether this passes depends on how ItemPrice normalizes scale internally and on how equality is implemented.

To avoid subtle failures, consider aligning both sides (e.g., same BigDecimal construction or using AssertJ’s isEqualByComparingTo("1200.00")) so the scale expectation is explicit.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 482d06a and 3be39d8.

📒 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, stockDROP COLUMN IF EXISTS로 제거해 기존 데이터/코드 정리 방향과 잘 맞습니다. 다른 인덱스나 제약조건에서 이 컬럼들을 참조하지 않는지만 한 번 더 점검하면 운영 배포 시 위험을 줄일 수 있습니다.

src/main/java/com/example/green/domain/pointshop/item/dto/request/CreatePointItemRequest.java (1)

35-45: 생성 요청 DTO에서 재고 제거 및 매핑 정리 완료

CreatePointItemRequestprice만 보유하고 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 constructor

The spy construction now matches the updated PointItem signature (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

price remains 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 signature

The record fields (code/info/media/price) align with the updated PointItem.create API 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 constructor

Both modification tests now build PointItem with ItemPrice only (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 stock

The constructor and from factory now exclude stock and only validate/assign price and point fields, which matches the new PointItem surface 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 invariants

The builder constructor, create factory, and validatePointItem now consistently require only code/basicInfo/media/price and still enforce non-null checks while defaulting displayStatus to DISPLAY. This cleanly reflects the removal of stock/selling status without weakening basic domain validation.

@sanchaehwa sanchaehwa merged commit c1717b7 into main Dec 5, 2025
2 checks passed
@sanchaehwa sanchaehwa deleted the fix/pointItem branch December 5, 2025 15:01
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.

1 participant