Repository navigation
feat: 내 주문 목록에 할인율·매장 지역 추가 - #551
Conversation
- calcDiscountRate를 product-storefront-mappers.helper에서 common/utils/discount-rate로 옮김. 주문 목록도 같은 규칙을 쓰게 돼 buildRegionLabel처럼 공용 표시 규칙으로 둠. - product 쪽 import 3곳 변경, spec은 it.each 표로 옮김(7케이스).
FE 마이페이지 주문상황 카드("매장명 · 지역", "할인율 % 금액")에 쓸 값이 MyOrderSummary에 없었음.
- 할인율: 주문 기준 discount_price ÷ subtotal_price 반올림(0~100, 할인 없으면 0).
옆에 붙는 금액이 주문 총액이라 숫자를 맞춤. 옵션 추가금은 할인 대상이 아니라 옵션 주문은 상품 카드 할인율보다 낮게 나옴.
- 지역: order_item.store_region_label_snapshot(nullable) 추가, 주문 생성 때 buildRegionLabel로 저장.
매장 실시간 조인은 read-boundary 허용 목록(Order.items.store.region)을 늘려 스냅샷으로 감.
- 마이그레이션 백필은 현재 매장 기준 같은 규칙. 빈 값 판정은 CHAR_LENGTH(NULLIF는 PAD SPACE로 공백값까지 비움).
- ProductRepository.findProductDetailById의 store select에 주소·지역 추가(Product·Store·Region 모두 catalog라 경계 항목 증가 없음).
- SDL: MyOrderSummary.discountRate: Int!, regionLabel: String (필드 추가만, FE 파괴적 변경 없음).
- 팩토리 createOrderItem은 미지정 시 생성 경로 규칙으로 지역 스냅샷을 채움.
- 시드 o1·o4: p1(정가 40,000·판매가 35,000)인데 subtotal 35,000/discount 0이던 것을 생성 경로 규칙(40,000/5,000)으로 맞춤.
테스트 17건 추가
- order-my.service: discountRate 4(옵션 포함·subtotal 0 반증), regionLabel 2(주문 뒤 매장 주소 변경 반증)
- order-checkout.service: 지역 스냅샷 3(시·동 / 지역명 / null)
- 백필 migration spec 8: buildRegionLabel과 결과 비교, 공백값 케이스는 NULLIF 버전에서 실패하는 것 확인
- order-my.resolver: 전체 경로 단언에 두 필드
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🧹 knip — dead-code 리포트전체 리포트
|
🩺 NestJS Doctor — 90/100 (Excellent)진단 493건 (error 13).
architecture / security 상위 항목
|
Coverage report
Show new covered files 🐣
Test suite run success4352 tests passing in 391 suites. Report generated by 🧪jest coverage report action from 0bdc9be |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
개요
마이페이지 주문상황 화면(
/mypage/orders) 카드의 "매장명 · 지역"과 "할인율 % 금액" 자리에 쓸 값을myOrders응답에 추가합니다.변경 사항
MyOrderSummary에discountRate: Int!와regionLabel: String을 추가했습니다.discount_price ÷ subtotal_price를 반올림한 0~100 정수이고, 할인이 없으면 0입니다.calcDiscountRate를 product feature에서src/common/utils/discount-rate.ts로 옮겨 함께 씁니다(별도 커밋).order_item.store_region_label_snapshot(nullable) 컬럼을 추가하고, 주문 생성 때buildRegionLabel로 저장합니다.read-boundary허용 목록이 늘어나므로 스냅샷으로 처리했습니다.CHAR_LENGTH로 합니다.findProductDetailById의 매장 select에 주소·지역을 더했습니다. Product·Store·Region이 모두 catalog 소유라 경계 항목은 늘지 않습니다.createOrderItem은 값을 지정하지 않으면 생성 경로 규칙으로 지역 스냅샷을 채웁니다.테스트
buildRegionLabel과 결과가 같은지 비교합니다.NULLIF버전으로 바꾸면 공백값 케이스 1건이 실패합니다.order_item6건이 모두 채워진 것을 확인했습니다.myOrders를 호출해 o1·o4 13%, o3 12%, 나머지 0%와 지역 표기를 확인했습니다.yarn validate:push(전체 jest 포함)를 통과했습니다.플랜 대조
discountRate: Int!·regionLabel: String추가order_item.store_region_label_snapshot String? VarChar(200)CASE+CHAR_LENGTH, 지역 soft-delete 미필터)calcDiscountRate→common/utils/discount-rate.ts, product import 3곳, spec 이동insertSubmittedOrder저장regionLabel·discountRate매핑(쿼리 변경 없음)createOrderItem지역 스냅샷 기본값myOrders