Skip to content

feat(routesF): language filter, diversity picks, mood filter, quiet hours config - #1367

Open
omarima-10 wants to merge 4 commits into
StreamFi-x:devfrom
omarima-10:feat/routesF-language-diversity-mood-quiethours
Open

feat(routesF): language filter, diversity picks, mood filter, quiet hours config#1367
omarima-10 wants to merge 4 commits into
StreamFi-x:devfrom
omarima-10:feat/routesF-language-diversity-mood-quiethours

Conversation

@omarima-10

Copy link
Copy Markdown
Contributor

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|fr returns 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=12 returns a diverse creator set via selectDiverse, 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|learning returns streams tagged with that mood, one test per mood via describe.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/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. 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 two viewers configured for different zones get different answers for the identical UTC time. Disabled configs always report false regardless of the window.

All work is inside app/api/routesF/; no imports from lib/, utils/, types/, or components/ 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 existing automod-presets/store.ts precedent in this repo.

Test plan

  • 56 new tests across 6 test files, all passing (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).
  • Each new file individually confirmed to add zero new TypeScript errors against the project's real 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 on upstream/dev itself — ~100 files under the differently-named app/api/routes-f/ (hyphenated, not this issue's routesF) import a _lib/validate module that doesn't exist in this checkout. Verified this is present on upstream/dev before any of my changes. None of the affected files are anywhere near what this PR touches. Commits in this PR used --no-verify for that reason (confirmed with the requester first) — each new file was individually checked against the real tsconfig and adds no new errors.

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.
@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

@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.

@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant