feat(routes-f): stream collaboration invite completed#1122
Open
rexx010 wants to merge 3 commits into
Open
Conversation
|
@rexx010 is attempting to deploy a commit to the david's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@rexx010 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
This PR introduces support for stream collaboration invitations and adds a Featured Stream of the Day endpoint to improve content discovery and collaboration across the platform.
Changes Made
Benefits
Issue 1: Stream Collaboration Invite ✅
Location: app/api/routes-f/collaboration-invites/
Files Created:
types.ts - TypeScript interfaces for requests/responses
store.ts - In-memory store with all business logic
route.ts - Next.js route handlers with Zod validation
collaboration-invites.test.ts
Endpoints Implemented:
POST /api/routes-f/collaboration-invites - Create new invitation
Input: {from_creator_id, to_creator_id, stream_id, message?}
Response: {invite_id, status: "pending"}
Duplicate prevention: Only one pending invitation allowed between same creator pair
PUT /api/routes-f/collaboration-invites - Respond to invitation
Input: {invite_id, decision: "accept" | "decline"}
Updates invitation status appropriately
GET /api/routes-f/collaboration-invites - List invitations
Query: creator_id
Response: {incoming: [], outgoing: []} with realistic invitation objects
PATCH /api/routes-f/collaboration-invites - Get invite details (helper endpoint)
Key Features:
✅ Realistic mock data with creator IDs, stream IDs, timestamps
✅ Deduplication logic for pending invites
✅ Complete invitation lifecycle (create → respond → status update)
✅ Proper error handling and validation
✅ Follows existing project patterns (runtime: "nodejs", dynamic: "force-dynamic")
✅ Uses Zod validation and shared validate utility
Issue 2: Featured Stream of the Day ✅
Location: app/api/routes-f/featured-stream/
Files Created:
types.ts - TypeScript interfaces for featured streams and overrides
mock-data.ts - Realistic creator roster with 10 diverse StreamFi creators
store.ts - Deterministic selection algorithm and override management
route.ts - Next.js route handlers with date validation
featured-stream.test.ts
Endpoints Implemented:
GET /api/routes-f/featured-stream - Get featured stream
Optional query: date (YYYY-MM-DD format)
Response: {featured: {creator, title, reason}, date, is_override: false}
POST /api/routes-f/featured-stream - Set editorial override
Input: {date, creator_id, reason}
Override takes precedence over automatic rotation
DELETE /api/routes-f/featured-stream - Remove editorial override
Input: {date}
PATCH /api/routes-f/featured-stream - Get featured stream with override info
Key Features:
✅ Deterministic rotation: Same date always returns same creator
✅ 10 realistic creators covering Gaming, Music, Tech, Art, Fitness, Cooking, Travel, Education, Comedy, Books
✅ Editorial override system: Priority over automatic selection
✅ Date-based hash algorithm for predictable rotation
✅ Realistic stream data with viewer counts, categories, thumbnails
✅ Proper date validation (YYYY-MM-DD format)
✅ UTC date handling for consistency
Quality Checklist Verification ✅
✓ Every file is inside app/api/routes-f/ - All 8 files created in the correct directories ✓ No imports from outside the folder - Only imports from ../../_lib/validate (allowed shared utility) ✓ Realistic mock data used - Domain-specific StreamFi creator data ✓ API contracts match requirements - All endpoints implement required schemas ✓ Collaboration lifecycle works - Create → respond → status updates complete ✓ Duplicate pending invites prevented - 409 conflict response for duplicates ✓ Incoming/outgoing retrieval works - Separate arrays for each direction ✓ Featured stream rotation is deterministic - Hash-based algorithm ✓ Editorial override has priority - Override takes precedence ✓ Tests cover required behavior - Comprehensive test suites created ✓ Implementation remains isolated - No external dependencies ✓ Code is clean and readable - Follows existing project patterns ✓ Mock data easily replaceable - Structured for backend/database integration
Closes #1097
Closes #1098