feat: storeReviews 좋아요순 정렬(sort=LIKES) 추가 - #173
Conversation
FE 요청 반영. 페이지 내 클라이언트 정렬로는 전체 기준 좋아요순이 불가능해 productReviews와 동일 의미론의 sort(LATEST/LIKES)를 추가한다. - repository를 id 페이지 + hydrate 구조로 재편(product 미러) - 좋아요순은 soft-delete 좋아요 제외 집계 기준이라 raw 키셋 페이지네이션((likeCount, id) 커서) 사용 - "<likeCount>:<id>" 커서 파싱에 안전 정수 검증 포함 - 기존 호출 영향 없음(sort 기본 LATEST, LATEST 커서는 기존 id 방식)
|
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 ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
🧹 knip — dead-code 리포트전체 리포트
|
🩺 NestJS Doctor — 89/100 (Good)진단 271건 (error 0).
architecture / security 상위 항목
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8e88ea3c1b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ? Prisma.sql`HAVING COUNT(l.id) < ${args.cursor.likeCount} | ||
| OR (COUNT(l.id) = ${args.cursor.likeCount} AND r.id < ${args.cursor.id})` |
There was a problem hiding this comment.
Preserve a stable like-rank snapshot across pages
When any review's likes change between page requests, this predicate compares every review's live COUNT(l.id) with a stale boundary and therefore does not prevent duplicates or omissions as claimed. For example, after a first page ends at 9 likes, an unseen 8-like review that rises to 10 is excluded from every subsequent query, while an already-returned 10-like review that drops to 8 is returned again. The cursor must identify a stable ranking snapshot/version, or the API must otherwise account for already-seen rows, to provide mutation-safe pagination.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
의도된 트레이드오프로 유지. 이 커서의 목적은 경계 리뷰의 좋아요 변동으로 인한 인접 페이지 즉시 중복/누락 방지까지이고, 임의 리뷰의 전역 변동까지 막으려면 랭킹 스냅샷·seen-set 커서가 필요해 공개 목록 조회에 과한 비용. 이미 릴리즈된 productReviews의 listProductReviewIdsByLikes와 동일 구현·동일 수용 기준이라 정합성 차원에서도 동일하게 둠.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Coverage report
Test suite run success1472 tests passing in 173 suites. Report generated by 🧪jest coverage report action from 8e88ea3 |
Summary
FE 요청 반영:
storeReviews에sort(LATEST/LIKES)를 추가한다. 현재는 최신순만 지원해 FE가 받은 페이지 안에서 재정렬해도 전체 기준 좋아요순이 될 수 없는 문제(1페이지에 없는 리뷰가 실제 좋아요 1위일 수 있음)를 해결한다.productReviews의 검증된 구현을 동일 의미론으로 미러링한다.StoreReviewsInput.sort: StoreReviewSort = LATEST(+StoreReviewSortenum)"<likeCount>:<id>"불투명 토큰 — 경계 시점 좋아요 수를 담아 요청 사이 좋아요 변동에도 페이지 중복/누락 없음Scope
store-reviews.graphql—sort입력 + enum, cursor 설명 갱신 (additive)store-reviews.input.ts—STORE_REVIEW_SORTS+@IsIn검증store-review.repository.ts— product 미러로 id 페이지 + hydrate 구조 재편:listStoreReviewIdsLatest/listStoreReviewIdsByLikes(raw 키셋) /findStoreReviewRowsByIdsstore-review.service.ts—fetchReviewIdPage+parseLikesCursor(안전 정수 검증) +hydrateReviewsstore-review-error-messages.ts—INVALID_LIKES_CURSOR신설진행 상황
yarn dto:check·yarn arch:check통과yarn validate전체 greenImpact
sort미지정 시 LATEST, LATEST 커서는 기존과 동일한 마지막 리뷰 id 방식.productReviews와 동일 규칙.Test plan
BadRequestException(BAD_USER_INPUT)sort=LIKES전달 경로