Skip to content

Fix issue1102#1114

Merged
davedumto merged 2 commits into
StreamFi-x:devfrom
JSE19:FixIssue1102
Jun 29, 2026
Merged

Fix issue1102#1114
davedumto merged 2 commits into
StreamFi-x:devfrom
JSE19:FixIssue1102

Conversation

@JSE19

@JSE19 JSE19 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Description

_Closes #1102

Changes proposed

What were you told to do?

feat(routes-f): Q&A question queue

Viewers submit questions during a stream and the streamer reads them in order.

Requirements:

  • POST { stream_id, viewer_id, question }{ question_id, queued_at }
  • GET ?stream_id returns pending queue sorted by queued_at
  • POST /answer { question_id, creator_id } marks as answered
  • POST /upvote { question_id, viewer_id } increments score (dedup per viewer)
  • Tests cover submit, upvote, answer flow

What did you do?

Created a self-contained Q&A question queue at app/api/routes-f/qa/:

  • route.ts — Two handlers:
    • POST — Submits a question, returns question_id and queued_at
    • GET — Returns unanswered questions for a stream sorted by queued_at (oldest first), with upvotes count per question
  • answer/route.tsPOST marks a question as answered (rejects already-answered with 409, missing with 404)
  • upvote/route.tsPOST increments score with per-viewer dedup (rejects duplicates with 409)
  • _lib/store.ts — Shared in-memory store (both route files import from here)
  • __tests__/route.test.ts — Tests covering:
    • Submit: valid submission, missing fields rejection
    • Queue: ordering by queued_at, answered questions excluded, empty stream
    • Answer: marks as answered, already-answered rejection, nonexistent question
    • Upvote: score increment, duplicate viewer rejection, multi-viewer upvotes, upvote count in queue response, nonexistent question

Check List

  • My code follows the code style of this project.
  • This PR does not contain plagiarized content.
  • The title and description of the PR is clear and explains the approach.
  • I am making a pull request against the main branch (left side).
  • My commit messages styles matches our requested structure.
  • My code additions will fail neither code linting checks nor unit test.
  • I am only making changes to files I was requested to.

@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

@JSE19 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 Jun 29, 2026

Copy link
Copy Markdown

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

@davedumto davedumto merged commit 59e8d3c into StreamFi-x:dev Jun 29, 2026
4 of 6 checks passed
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.

2 participants