Skip to content

feat(swap-service): affiliate stats/swaps reads are partnerCode-only#45

Merged
kaladinlight merged 2 commits into
developfrom
feat/swap-service-affiliate-reads-partner-code-only
Jun 30, 2026
Merged

feat(swap-service): affiliate stats/swaps reads are partnerCode-only#45
kaladinlight merged 2 commits into
developfrom
feat/swap-service-affiliate-reads-partner-code-only

Conversation

@kaladinlight

Copy link
Copy Markdown
Member

Description

Contract step after #44. Now that public-api queries /v1/affiliate/{stats,swaps} by partnerCode (shapeshift/web#12473), drop the legacy address path from those reads — partnerCode is the sole, canonical attribution key.

  • DTOs (AffiliateStatsQueryDto, AffiliateSwapsQueryDto): partnerCode is now required; the optional address field is removed.
  • Controller: /swaps and /stats route straight to the partnerCode methods (no address branch, no "one of" 400).
  • Service: removed the now-dead getAffiliateStatsByAddress / getAffiliateSwapsByAddress and their tests.

partnerAddress is untouched on the write side — it remains the per-swap payout snapshot and feeds the resolvePartner reverse-lookup for X-Partner-Address callers. This PR only removes the address-based read path.

Deploy ordering

Ship after web#12473 (which makes public-api send partnerCode on reads). Until then, the only caller is public-api; once it's on partnerCode, the address read path here is dead. swap-service is API-key gated, so there are no other callers.

Testing

  • yarn jest (swap-service): 56/56 pass (removed the 2 obsolete by-address read tests).
  • eslint clean on changed files.

Contract step after #44: now that public-api queries by partnerCode, drop
the legacy address path from /v1/affiliate/{stats,swaps}.

- DTOs require partnerCode, drop the optional address field
- controller routes straight to the partnerCode methods (no address branch)
- remove the now-dead getAffiliate{Stats,Swaps}ByAddress service methods
  and their tests

partnerAddress remains on swaps (payout snapshot) and the write-path
reverse-lookup is untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@kaladinlight, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 15 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bc30cfbf-404a-45f1-ba3a-0a9c26ff1c29

📥 Commits

Reviewing files that changed from the base of the PR and between 2385039 and 8c48923.

📒 Files selected for processing (6)
  • apps/swap-service/src/affiliate/__tests__/affiliate.service.test.ts
  • apps/swap-service/src/affiliate/affiliate.controller.ts
  • apps/swap-service/src/affiliate/affiliate.service.ts
  • apps/swap-service/src/affiliate/types.ts
  • apps/swap-service/src/swaps/swaps.controller.ts
  • apps/swap-service/src/swaps/swaps.service.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/swap-service-affiliate-reads-partner-code-only

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.

Each method now has a single variant (the by-address ones are gone), so
the suffix is noise:
- getAffiliateStatsByPartnerCode  -> getAffiliateStats
- getAffiliateSwapsByPartnerCode  -> getAffiliateSwaps
- calculateAffiliateFeesByPartnerCode -> calculateAffiliateFees

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@kaladinlight
kaladinlight merged commit 0422a84 into develop Jun 30, 2026
2 checks passed
@kaladinlight
kaladinlight deleted the feat/swap-service-affiliate-reads-partner-code-only branch June 30, 2026 18:28
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