Skip to content

[Contests] Add GET /v1/users/{id}/contests endpoint#789

Closed
dylanjeffers wants to merge 3 commits intomainfrom
claude/vigilant-chatelet-3b7c1f
Closed

[Contests] Add GET /v1/users/{id}/contests endpoint#789
dylanjeffers wants to merge 3 commits intomainfrom
claude/vigilant-chatelet-3b7c1f

Conversation

@dylanjeffers
Copy link
Copy Markdown
Contributor

Summary

  • New per-user remix-contest endpoint (`GET /v1/users/{id}/contests`) so the profile "Contests" tab can fetch only the artist's contests instead of paginating the global discovery list and filtering client-side.
  • Mirrors `v1EventsRemixContests` ordering (active first by soonest `end_date`, then ended most-recent-first) and `related` payload shape (`users`, `tracks`, `entry_counts`) so call sites can swap without changing render logic.
  • Mounted at both `/v1/users/:userId/contests` and `/v1/users/handle/:handle/contests` to match the existing artist-tracks/artist-albums pattern.

Test plan

  • `go build ./...` succeeds
  • `v1_users_contests_test.go` covers: ordering, host scoping (no leakage from other hosts), `status=active|ended` filter, related-payload shape, empty case
  • Verify swagger renders the new path under the `users` tag
  • Pair with the `apps` companion PR that updates `useUserHasRemixContest` and the profile `ContestsTab` to call this endpoint

🤖 Generated with Claude Code

dylanjeffers and others added 3 commits May 5, 2026 20:56
…lgorithm

Implements a personalized For You feed modeled on Twitter's 2023
open-sourced timeline pipeline (candidate generation -> ranking ->
filtering -> diversity).

Candidate sources (4):
- in-network: recent uploads from artists the viewer follows
- weekly trending (track_trending_scores, time_range=week)
- underground trending (sub-1500 follower/following artists)
- similar-artist 1-hop CF: artists co-saved by users who saved my saved
  artists' tracks

Ranking (SQL-side):
- 48h half-life recency: EXP(-LN(2) * hours_old / 48)
- engagement: LN(1 + 3*saves + 2*reposts + plays) (saves > reposts > plays)
- social affinity: 1 + min(LN(1 + my_engagement_count) / 4, 1)
- source weight: in-network 1.20, trending 1.00, underground 0.95, similar 0.90

Filtering / diversity:
- hard filters mirror the v1_events_remix_contests.go pattern:
  is_delete=false, is_unlisted=false, is_available=true, stem_of IS NULL,
  no access_authorities, owner not deactivated
- excludes tracks the viewer has already saved
- 3-per-artist cap via ROW_NUMBER() OVER (PARTITION BY owner_id)
- Go-side greedy diversity pass with a 5-track lookahead to avoid
  consecutive same-artist tracks without disturbing global rank

Pagination: user_id (required), limit (1-100, default 25), offset (0-200).

Consumed by apps#14237.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add the OpenAPI entry for the new endpoint so it shows up in
/v1 (swagger UI) and the SDK codegen pipeline.

Documents the four query params (user_id required; limit, offset,
max_per_artist optional with min/max bounds matching the handler's
validate tags) and points the 200 response at the existing
"tracks" component schema.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add a per-user remix-contest endpoint so the profile "Contests" tab can
fetch only the artist's contests instead of paginating the global discovery
list and filtering client-side. Mirrors the discovery endpoint's ordering
(active first by soonest end_date, then ended most-recent-first) and
`related` payload shape so call sites can swap without changing render
logic.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dylanjeffers
Copy link
Copy Markdown
Contributor Author

Duplicate — #791 already merged

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