feat(routesF): language filter, diversity picks, mood filter, quiet hours config - #1367
Open
omarima-10 wants to merge 4 commits into
Open
Conversation
Adds app/api/routesF/live-streams-by-language/: GET ?language=en|es|fr returns live streams matching the requested language sorted by viewer count desc; omitting the filter returns every seed stream, still sorted. Rejects an unsupported language with 400.
Adds app/api/routesF/diversity-boosted-picks/: GET ?viewer_id&count=12 returns a diverse creator set via selectDiverse, which round-robins across categories capping at 2 per category before backfilling further from categories with more to offer, so the result never falls short of the requested count just to preserve diversity.
Adds app/api/routesF/mood-filter/: GET ?mood=chill|hype|chat|gaming|learning returns live streams tagged with that mood. Missing mood returns 400; an unrecognized mood value returns 404, per the issue's explicit spec.
Adds app/api/routesF/quiet-hours-notification-config/: GET/PUT for a
per-viewer quiet-hours window (start_hour, end_hour, timezone, enabled),
and POST /check-quiet { viewer_id, at? } -> { in_quiet_hours }.
isHourInQuietWindow handles a window crossing midnight (e.g. 22 -> 8) via
an OR check instead of the same-day AND check; start === end is treated
as a full 24h window. isInQuietHours resolves the local hour for the
configured IANA timezone via Intl.DateTimeFormat (hourCycle: h23) rather
than the raw UTC hour, verified with a same-instant/different-timezone
test showing different viewers get different answers for identical UTC
times when configured for different zones. Disabled configs always
report not-in-quiet-hours regardless of the window.
|
@omarima-10 is attempting to deploy a commit to the david's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@omarima-10 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! 🚀 |
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.
Summary
Four self-contained routesF practice implementations, each with seed data and its own test file(s).
closes #1234
closes #1244
closes #1246
closes #1250
Changes
feat(routesF): live streams by language #1234 — Live streams by language (
app/api/routesF/live-streams-by-language/):GET ?language=en|es|frreturns live streams matching the language, sorted by viewer count desc. Omitting the filter returns every seed stream, still sorted. Unsupported language → 400.feat(routesF): diversity-boosted picks #1244 — Diversity-boosted picks (
app/api/routesF/diversity-boosted-picks/):GET ?viewer_id&count=12returns a diverse creator set viaselectDiverse, which round-robins across categories capping at 2 per category, then backfills further from categories with more to offer once every category has contributed its share — so the result never falls short of the requested count just to preserve diversity. Tests verify no category exceeds 2 when the count allows spreading out, and that backfill kicks in correctly when it can't.feat(routesF): mood filter #1246 — Mood filter (
app/api/routesF/mood-filter/):GET ?mood=chill|hype|chat|gaming|learningreturns streams tagged with that mood, one test per mood viadescribe.each. Missing mood → 400; unrecognized mood → 404, per the issue's explicit spec.feat(routesF): quiet hours notification config #1250 — Quiet hours notification config (
app/api/routesF/quiet-hours-notification-config/):GET/PUTfor a per-viewer quiet-hours window (start_hour,end_hour,timezone,enabled), andPOST /check-quiet { viewer_id, at? } -> { in_quiet_hours }.isHourInQuietWindowhandles a window crossing midnight (e.g. 22→8) via an OR check instead of the same-day AND check.isInQuietHoursresolves the local hour for the configured IANA timezone viaIntl.DateTimeFormat(hourCycle: 'h23') rather than the raw UTC hour — verified with a same-instant/different-timezone test showing two viewers configured for different zones get different answers for the identical UTC time. Disabled configs always reportfalseregardless of the window.All work is inside
app/api/routesF/; no imports fromlib/,utils/,types/, orcomponents/per the scope constraint — shared logic between a route and its sub-route (e.g. quiet-hours'store.ts) is duplicated inside that issue's own subfolder, following the existingautomod-presets/store.tsprecedent in this repo.Test plan
npx jest app/api/routesF/live-streams-by-language app/api/routesF/diversity-boosted-picks app/api/routesF/mood-filter app/api/routesF/quiet-hours-notification-config).tsconfig.json.Pre-existing and unrelated: this repo's
npm run build/type-check(and the husky pre-commit hook that runs it) currently fails onupstream/devitself — ~100 files under the differently-namedapp/api/routes-f/(hyphenated, not this issue'sroutesF) import a_lib/validatemodule that doesn't exist in this checkout. Verified this is present onupstream/devbefore any of my changes. None of the affected files are anywhere near what this PR touches. Commits in this PR used--no-verifyfor that reason (confirmed with the requester first) — each new file was individually checked against the real tsconfig and adds no new errors.