Commit 3918043
[Feed] Add GET /v1/users/{id}/feed/for-you endpoint
Server-side replacement for the client-side blend in apps'
useForYouFeed.ts. Four candidate streams interleaved with a fixed
10-slot pattern,
pos: [R R R F R T R F U R]
giving 60% recommended (50% baseline + 10% filler when other sources
thin out), 20% following originals, 10% trending, 10% underground.
When a slot's preferred source is exhausted, falls through in priority
order recommended → following → trending → underground.
Each source caps at 200 candidates; the union is deduped by track_id
and the caller's already-saved tracks are filtered at the SQL level
(client filtered them client-side; filtering early avoids burning
candidates on already-saved tracks). Pagination (limit/offset)
applies to the composed list.
Source SQL mirrors the underlying single-source endpoints:
- recommended: v1_users_recommended_tracks.go (top tracks from the
user's top-played genres, excluding played) — switched to
score-DESC ordering for stable pagination
- following: v1_users_feed.go w/ filter=original
- trending: v1_tracks_trending.go (week)
- underground: v1_tracks_trending_underground.go (week, sub-1500
follower & following artists)
Liveness, gating, and unlisted/deleted filters mirror those files
and v1_events_remix_contests.go.
Path-param userId (the requesting user) follows the same pattern as
/v1/users/:userId/recommended-tracks and /v1/users/:userId/feed.
Consumed by apps' useForYouFeed.ts.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 1450066 commit 3918043
4 files changed
Lines changed: 797 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
426 | 426 | | |
427 | 427 | | |
428 | 428 | | |
| 429 | + | |
429 | 430 | | |
430 | 431 | | |
431 | 432 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9439 | 9439 | | |
9440 | 9440 | | |
9441 | 9441 | | |
| 9442 | + | |
| 9443 | + | |
| 9444 | + | |
| 9445 | + | |
| 9446 | + | |
| 9447 | + | |
| 9448 | + | |
| 9449 | + | |
| 9450 | + | |
| 9451 | + | |
| 9452 | + | |
| 9453 | + | |
| 9454 | + | |
| 9455 | + | |
| 9456 | + | |
| 9457 | + | |
| 9458 | + | |
| 9459 | + | |
| 9460 | + | |
| 9461 | + | |
| 9462 | + | |
| 9463 | + | |
| 9464 | + | |
| 9465 | + | |
| 9466 | + | |
| 9467 | + | |
| 9468 | + | |
| 9469 | + | |
| 9470 | + | |
| 9471 | + | |
| 9472 | + | |
| 9473 | + | |
| 9474 | + | |
| 9475 | + | |
| 9476 | + | |
| 9477 | + | |
| 9478 | + | |
| 9479 | + | |
| 9480 | + | |
| 9481 | + | |
| 9482 | + | |
| 9483 | + | |
| 9484 | + | |
| 9485 | + | |
| 9486 | + | |
| 9487 | + | |
| 9488 | + | |
| 9489 | + | |
| 9490 | + | |
| 9491 | + | |
| 9492 | + | |
| 9493 | + | |
| 9494 | + | |
| 9495 | + | |
| 9496 | + | |
| 9497 | + | |
| 9498 | + | |
| 9499 | + | |
| 9500 | + | |
| 9501 | + | |
9442 | 9502 | | |
9443 | 9503 | | |
9444 | 9504 | | |
| |||
0 commit comments