feat: add permalink to event API responses#944
Merged
Conversation
The /v1/events/entity endpoint returned only `data`, so every consumer that
resolves a contest through it had to fire a separate
`/tracks/{id}/remixes?only_contest_entries=true&limit=0` just to render the
entry-count badge. This is an N+1 on web Explore's featured contests (one
count request per card) and an extra round-trip on the track-page contest
section and cold/deep-linked contest pages.
Compute per-contest entry counts alongside the events query and return them
under `related.entry_counts`, keyed by the contest's parent track hashid —
mirroring the existing /events/remix-contests discovery endpoint so the client
can prime `useRemixesCount({ isContestEntry: true })` directly. The count uses
the same in-window filter (child track created after contest start, before
end_date, currently listed) and only applies to remix_contest events on track
entities.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Left-join event_routes on event queries to expose permalink field. Adds migration 0218_create_event_routes.sql, updates GetEvents query and v1_events_remix_contests handler, seeds fixture data in tests. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Joins event_routes on event queries to expose permalink field in API responses. Adds migration 0218, updates GetEvents SQL and v1_events_remix_contests handler, seeds fixture data in tests.