Skip to content

feat(routes-f): add tip refund, heatmap, playback source, and resume …#1085

Merged
davedumto merged 1 commit into
StreamFi-x:devfrom
JoyLight00:feat/routes-f-tip-refund-heatmap-playback-source-resume-position
Jun 27, 2026
Merged

feat(routes-f): add tip refund, heatmap, playback source, and resume …#1085
davedumto merged 1 commit into
StreamFi-x:devfrom
JoyLight00:feat/routes-f-tip-refund-heatmap-playback-source-resume-position

Conversation

@JoyLight00

@JoyLight00 JoyLight00 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

feat(routes-f): add 4 new route handlers — tip refund, tip heatmap, playback source selection, and resume position

Resolves #1048,
Closes : #1023,
Closes : #1030,
Closes : #1031

All files are scoped to app/api/routes-f/ per the task constraints. No modifications to lib/, utils/, types/, components/, or any other shared directories.

Changes

1. Tip Refund Request (#1048)

  • POST /api/routes-f/tip-refund — Submits a refund request. Validates tip age (rejects >24h with 400), verifies tipper ownership (403 mismatch), returns { request_id, status: "pending" } on success.
  • POST /api/routes-f/tip-refund/resolve — Creator approves or denies a pending request. Returns 409 if already resolved.

2. Tip Heatmap by Hour (#1023)

  • GET /api/routes-f/tip-heatmap?creator_id=... — Returns a 7x24 matrix of USDC totals bucketed by day-of-week and hour-of-day.
  • Seed tip data is bundled in-module. Bucketing uses each creator's local timezone (e.g. America/New_York, Europe/London) via Intl.DateTimeFormat.

3. Viewer Playback Source Selection (#1030)

  • POST /api/routes-f/playback-source — Records a viewer's manual quality selection (viewer_id, playback_id, quality_label), maps to known resolutions.
  • GET /api/routes-f/playback-source?viewer_id=... — Returns { last_quality: { label, resolution } }.

4. Resume from Last Position (#1031)

  • POST /api/routes-f/resume-position — Saves viewer VOD position (viewer_id, vod_id, position_seconds, duration_seconds). Automatically flags completed: true when position >= 95% of duration.
  • GET /api/routes-f/resume-position?viewer_id=...&vod_id=... — Returns { position_seconds, completed }.

Tests

  • app/api/routes-f/__tests__/tip-refund.test.ts — 10 tests covering request creation, 24h expiry, tipper mismatch, approval, denial, and duplicate resolution.
  • app/api/routes-f/__tests__/tip-heatmap.test.ts — 8 tests covering matrix shape, timezone lookup, and bucket math against known UTC timestamps.
  • app/api/routes-f/__tests__/playback-source.test.ts — 7 tests covering store, overwrite, and retrieval.
  • app/api/routes-f/__tests__/resume-position.test.ts — 10 tests covering save, resume, completion threshold, and overwrite.

All tests pass.

@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

@JoyLight00 is attempting to deploy a commit to the david's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 26, 2026

Copy link
Copy Markdown

@JoyLight00 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@davedumto davedumto merged commit 0f8d461 into StreamFi-x:dev Jun 27, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants