Skip to content

refactor(seller): Connection 형태를 구매자 API와 정합화 (hasMore·totalCount) - #286

Merged
chanwoo7 merged 1 commit into
developfrom
refactor/seller-connection-shape
Sep 9, 2026
Merged

chanwoo7 merged 1 commit into
developfrom
refactor/seller-connection-shape

Conversation

@chanwoo7

@chanwoo7 chanwoo7 commented Sep 9, 2026

Copy link
Copy Markdown
Member

판매자 목록 8종이 { items, nextCursor }만 내려줘 구매자 Connection과 형태가 달랐다. 프론트가 "더 있는지"를 nextCursor의 null 여부로 추론해야 했고, 전체 건수는 알 방법이 없었다.

변경

필드 대상 비용
hasMore: Boolean! 8종 전부 없음
totalCount: Int! 7종 (sellerAuditLogs 제외) 목록당 COUNT 1회

hasMore가 공짜인 이유는 nextCursorOf가 이미 limit+1 조회 결과로 다음 페이지 유무를 판정하고 있었기 때문이다. 그 값을 버리고 있었을 뿐이라 노출만 했다.

sellerAuditLogstotalCount를 제외했다 — 누적형 로그라 매 조회 COUNT가 부담이다. SDL에도 이유를 주석으로 남겼다.

count 조건이 목록과 갈라지지 않게

배너·일별 수량·상품·주문은 필터 조건이 있어, 목록과 카운트가 같은 where 빌더를 보도록 분리했다. 커서만 페이지 조건으로 따로 붙인다.

where: {
  ...(args.cursor ? { id: { lt: args.cursor } } : {}),
  ...this.storeOrderScopeWhere(args),
}

조건이 두 곳에 복사돼 있으면 한쪽만 바뀌었을 때 totalCount가 조용히 틀려진다. 이 레포에 이미 같은 이유의 선례가 있다 — 매장 검색의 "후보 조건과 단일 소스" 주석.

totalCount 의미

커서를 제외한 필터 기준 전체 건수다. 페이지 크기와 무관하고 status 같은 필터는 반영된다. 테스트로 고정했다.

테스트 +4

  • 0건일 때 totalCount 0, hasMore false
  • 정확히 limit개면 hasMore false / 초과하면 true (경계)
  • totalCount가 페이지가 아니라 필터 전체를 센다
  • 감사 로그는 hasMore만 내리고 totalCountundefined

전체 225 suites / 1,873건 통과. tsc·dto:check·arch:check·docs:check·test:scripts 통과.

하위 호환

필드 추가라 기존 FE 쿼리는 그대로 동작한다.

판매자 목록 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건 통과.
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: dfe03d7d-aa95-4c9e-9fc9-83a724363820

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

🧹 knip — dead-code 리포트

Unused dependencies (1)
Duplicate exports (1)
전체 리포트
Unused dependencies (1)
graphql-ws  package.json:65:6
Duplicate exports (1)
KEYWORD_RANK_SNAPSHOT_SIZE|MAX_POPULAR_KEYWORDS_LIMIT  src/features/search/constants/search.constants.ts

청소 후보(오탐 가능) · 기준 docs/guide/architecture-conventions.md

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

🩺 NestJS Doctor — 90/100 (Excellent)

진단 313건 (error 0).

Category error warning info
architecture 0 0 9
correctness 0 161 0
performance 0 27 17
schema 0 0 86
security 0 13 0
architecture / security 상위 항목
  • info architecture/architecture/no-barrel-export-internals: Barrel file re-exports internal type 'IAuditLogRepository'.
  • warning security/security/no-exposed-env-vars: Direct 'process.env.NODE_ENV' access in 'AuthController'. Use ConfigService instead.
  • warning security/security/require-guards-on-endpoints: Endpoint 'start' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'callback' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'refresh' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'logout' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'sellerLogin' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'sellerRefresh' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'sellerLogout' has no @UseGuards() at class or method level.
  • warning security/security/require-guards-on-endpoints: Endpoint 'devIssueToken' has no @UseGuards() at class or method level.
  • info architecture/architecture/no-barrel-export-internals: Barrel file re-exports internal module '@/features/conversation/repositories/conversation.repository'.
  • info architecture/architecture/no-barrel-export-internals: Barrel file re-exports internal type 'ConversationRepository'.
  • info architecture/architecture/no-barrel-export-internals: Barrel file re-exports internal module '@/features/order/repositories/order.repository'.
  • info architecture/architecture/no-barrel-export-internals: Barrel file re-exports internal type 'OrderRepository'.
  • info architecture/architecture/no-barrel-export-internals: Barrel file re-exports internal module '@/features/product/repositories/product.repository'.

오탐 포함 가능 · 기준 docs/guide/architecture-conventions.md

@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.28571% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...rc/features/order/repositories/order.repository.ts 80.00% 0 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 97.69% 5909/6049
🟢 Branches 93.12% 2316/2487
🟢 Functions 96.47% 1176/1219
🟢 Lines 98.27% 5382/5477

Test suite run success

1873 tests passing in 225 suites.

Report generated by 🧪jest coverage report action from e10ca61

@chanwoo7
chanwoo7 merged commit eac1f31 into develop Sep 9, 2026
12 checks passed
@chanwoo7
chanwoo7 deleted the refactor/seller-connection-shape branch September 9, 2026 17:26
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