refactor(seller): Connection 형태를 구매자 API와 정합화 (hasMore·totalCount) - #286
Conversation
판매자 목록 8종이 { items, nextCursor }만 내려줘 구매자 Connection과 형태가
달랐다. 프론트가 "더 있는지"를 nextCursor의 null 여부로 추론해야 했고 전체
건수는 알 방법이 없었다.
- hasMore: 8종 전부. 추가 쿼리가 없다 — nextCursorOf가 이미 limit+1 조회
결과로 판정하고 있어 그 값을 노출만 했다
- totalCount: 7종. sellerAuditLogs만 제외했다 — 누적형 로그라 매 조회 COUNT가
부담이다(SDL에도 주석으로 이유를 남겼다)
count 조건이 목록과 어긋나지 않도록 where 빌더를 분리했다. 배너·일별 수량·상품·
주문은 필터 조건이 있어 목록과 카운트가 같은 함수를 보고, 커서만 페이지 조건으로
따로 붙인다. 조건이 갈라지면 totalCount가 조용히 틀려지는 자리다.
totalCount는 커서를 제외한 필터 기준 전체 건수다. 페이지 크기와 무관하고,
status 같은 필터는 반영된다.
테스트 +4: 0건일 때 totalCount 0·hasMore false / 정확히 limit개면 hasMore false,
초과하면 true / totalCount가 페이지가 아니라 필터 전체를 센다 / 감사 로그는
hasMore만 내리고 totalCount는 undefined.
전체 225 suites 1,873건 통과.
|
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: Advanced 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 — 90/100 (Excellent)진단 313건 (error 0).
architecture / security 상위 항목
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Coverage report
Test suite run success1873 tests passing in 225 suites. Report generated by 🧪jest coverage report action from e10ca61 |
판매자 목록 8종이
{ items, nextCursor }만 내려줘 구매자 Connection과 형태가 달랐다. 프론트가 "더 있는지"를nextCursor의 null 여부로 추론해야 했고, 전체 건수는 알 방법이 없었다.변경
hasMore: Boolean!totalCount: Int!sellerAuditLogs제외)hasMore가 공짜인 이유는nextCursorOf가 이미limit+1조회 결과로 다음 페이지 유무를 판정하고 있었기 때문이다. 그 값을 버리고 있었을 뿐이라 노출만 했다.sellerAuditLogs만totalCount를 제외했다 — 누적형 로그라 매 조회 COUNT가 부담이다. SDL에도 이유를 주석으로 남겼다.count 조건이 목록과 갈라지지 않게
배너·일별 수량·상품·주문은 필터 조건이 있어, 목록과 카운트가 같은 where 빌더를 보도록 분리했다. 커서만 페이지 조건으로 따로 붙인다.
조건이 두 곳에 복사돼 있으면 한쪽만 바뀌었을 때
totalCount가 조용히 틀려진다. 이 레포에 이미 같은 이유의 선례가 있다 — 매장 검색의 "후보 조건과 단일 소스" 주석.totalCount 의미
커서를 제외한 필터 기준 전체 건수다. 페이지 크기와 무관하고
status같은 필터는 반영된다. 테스트로 고정했다.테스트 +4
totalCount0,hasMorefalsehasMorefalse / 초과하면 true (경계)totalCount가 페이지가 아니라 필터 전체를 센다hasMore만 내리고totalCount는undefined전체 225 suites / 1,873건 통과.
tsc·dto:check·arch:check·docs:check·test:scripts통과.하위 호환
필드 추가라 기존 FE 쿼리는 그대로 동작한다.