diff --git a/README.md b/README.md index 52c75b6..279b77b 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,17 @@ Web application (PWA) for the dance community enabling matchmaking, chat, and vi - ✅ **Infinite Scroll** - loading older messages **Matchmaking & Private Chat:** -- ✅ **Matchmaking** - pairing directly from event chat -- ✅ **Private 1:1 Chat** - private chat for matched users with Socket.IO +- ✅ **Match Requests** - send and accept match requests with real-time notifications +- ✅ **Match Management** - view pending/active matches, accept/reject requests +- ✅ **Private 1:1 Chat** - private chat for matched users with Socket.IO and message history +- ✅ **Match Slugs** - secure random slugs (CUID) preventing ID enumeration + +**Ratings & Reviews:** +- ✅ **Partner Ratings** - rate collaboration partners (1-5 stars, comments) +- ✅ **Collaboration Preferences** - "would collaborate again" indicator +- ✅ **Public Rating Display** - ratings visible on public user profiles +- ✅ **Duplicate Prevention** - users can only rate each match once +- ✅ **Auto-completion** - matches auto-complete when both partners have rated **Backend & Infrastructure:** - ✅ **PostgreSQL Database** - 7 tables with relations (Prisma ORM) @@ -39,12 +48,11 @@ Web application (PWA) for the dance community enabling matchmaking, chat, and vi - ✅ **Docker Compose** - full orchestration (nginx, frontend, backend, PostgreSQL) - ✅ **Test Coverage** - 81%+ coverage (Jest + Supertest) -### 🔜 In Progress +### 🔜 Next Up -- ⏳ **Matches API** - create/accept match requests -- ⏳ **Ratings API** - rate partner after collaboration (1-5 stars) -- ⏳ **WebRTC Signaling** - SDP/ICE exchange via Socket.IO +- ⏳ **WebRTC Signaling** - SDP/ICE exchange via Socket.IO for P2P connections - ⏳ **WebRTC P2P Transfer** - real file transfer via RTCDataChannel +- ⏳ **Competition Heats** - complete UI integration and real-time updates ## 🛠️ Tech Stack @@ -226,10 +234,11 @@ docker compose --profile dev up --build - id, room_id, user_id, content, type (text/link/video), created_at 6. **matches** - user pairs - - id, user1_id, user2_id, event_id, room_id, status (pending/accepted/completed), created_at + - id, slug (unique cuid), user1_id, user2_id, event_id, room_id, status (pending/accepted/completed), created_at 7. **ratings** - ratings - id, match_id, rater_id, rated_id, score (1-5), comment, would_collaborate_again, created_at + - Unique constraint: (match_id, rater_id, rated_id) - prevents duplicate ratings ### Migrations @@ -396,9 +405,16 @@ docker compose exec backend npm run test:coverage - Event participation tracking - Event security (slugs) -### ⏳ Phase 2: Core Features (IN PROGRESS) -- Matches API (create/accept match requests) -- Ratings API (rate partner after collaboration) +### ✅ Phase 2: Matches & Ratings API (COMPLETED) +- Matches API (create/accept match requests with slugs) +- Real-time match notifications via Socket.IO +- Ratings API (1-5 stars, comments, collaboration preferences) +- Public profile ratings display +- Profile links from chat and matches pages +- Message history for matches +- Duplicate rating prevention + +### ⏳ Phase 2.5: WebRTC Implementation (NEXT) - WebRTC signaling (SDP/ICE exchange) - WebRTC P2P file transfer (RTCDataChannel) @@ -452,6 +468,6 @@ TBD --- -**Current Status:** Phase 1.5 ✅ Completed | Phase 2 ⏳ In Progress (65% overall) +**Current Status:** Phase 2 ✅ Completed | Phase 2.5 (WebRTC) ⏳ Next | Progress: ~72% overall -**Last Updated:** 2025-11-13 +**Last Updated:** 2025-11-14 diff --git a/docs/COMPLETED.md b/docs/COMPLETED.md index b1fc987..03f3d79 100644 --- a/docs/COMPLETED.md +++ b/docs/COMPLETED.md @@ -151,6 +151,88 @@ --- +## ✅ Phase 2: Matches & Ratings API (COMPLETED) + +**Completed:** 2025-11-14 +**Time Spent:** ~10 hours +**Status:** Production-ready with full CRUD operations and real-time updates + +### Step 1: Matches API Implementation +- [x] Database schema: + - Added `slug` field to Match model (CUID for security) + - Migration: `20251114183814_add_match_slug` + - Unique constraint on slug +- [x] Backend endpoints: + - `POST /api/matches` - Create match request (with event slug, target user) + - `GET /api/matches` - List matches with filters (eventSlug, status) + - `GET /api/matches/:slug` - Get match details with hasRated flag + - `GET /api/matches/:slug/messages` - Get match message history + - `PUT /api/matches/:slug/accept` - Accept match request + - `DELETE /api/matches/:slug` - Reject/cancel match + - Real-time notifications via Socket.IO (match_request_received, match_accepted, match_cancelled) +- [x] Frontend pages: + - MatchesPage.jsx - List and manage matches with filter tabs (all/pending/active) + - MatchChatPage.jsx - Private 1:1 chat with message history loading + - Updated EventChatPage - UserPlus button creates match requests +- [x] Security: + - CUID slugs prevent ID enumeration + - URLs: `/matches/{slug}/chat` instead of `/matches/{id}/chat` + - Partner-based access control + +### Step 2: Ratings API Implementation +- [x] Database schema: + - Rating model with unique constraint (match_id, rater_id, rated_id) + - Fields: score (1-5), comment, would_collaborate_again +- [x] Backend endpoints: + - `POST /api/matches/:slug/ratings` - Create rating + - `GET /api/users/:username/ratings` - Get user ratings (last 50) + - hasRated flag in match response + - Auto-complete match when both users rate +- [x] Frontend integration: + - RatePartnerPage.jsx - Real API integration with validation + - Duplicate rating prevention (redirect if already rated) + - "✓ Rated" badge in MatchChatPage when user has rated + - PublicProfilePage.jsx - Display ratings with stars, comments, and collaboration preferences +- [x] Validation: + - Score 1-5 required + - Comment optional + - One rating per user per match (database constraint) + +### Step 3: Public Profile Ratings Display +- [x] PublicProfilePage enhancements: + - Fetch and display user ratings using ratingsAPI.getUserRatings() + - Summary section: average rating with star visualization, total count + - Individual ratings section: + - Rater avatar and name (clickable links to their profiles) + - Star rating (1-5 filled stars) + - Comment text + - "Would collaborate again" indicator with thumbs up icon + - Event context (clickable link) and date + - Loading states and empty states +- [x] Profile navigation: + - MatchesPage: Partner avatar and name link to profile + - MatchChatPage: Header avatar and name link to profile + - Hover effects on all profile links + +### Git Commits (Phase 2) +1. `feat: implement Phase 2 - Matches API with real-time notifications` +2. `feat: add match slugs for security and fix message history loading` +3. `feat: implement Ratings API (Phase 2.5)` +4. `feat: prevent duplicate ratings and show rated status in chat` +5. `feat: display user ratings on public profiles and add profile links` + +### Key Features +- Secure match URLs with CUID slugs +- Real-time match notifications via Socket.IO +- Message history persistence and loading +- Complete ratings system with duplicate prevention +- Auto-match completion when both users rate +- Public profile ratings display with detailed reviews +- Clickable profile links throughout the app +- Comprehensive validation and error handling + +--- + ## 🐳 1. Setup projektu i infrastruktura ### Docker Compose @@ -361,5 +443,5 @@ docs: update TODO.md with completed tasks and next steps --- -**Last Updated:** 2025-11-14 +**Last Updated:** 2025-11-14 (Phase 2 completed) **Note:** This file is an archive. For current tasks, see TODO.md diff --git a/docs/TODO.md b/docs/TODO.md index de00398..54d83da 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -6,10 +6,10 @@ ## 🎯 CURRENT STATUS -**Phase:** 1.6 (Competition Heats System) - ⏳ IN PROGRESS -**Previous Phase:** 1.5 (Email & WSDC & Profiles & Security & QR Check-in) - ✅ COMPLETED -**Next Phase:** 2 (Core Features - Matches API + Ratings + WebRTC) - ⏳ PENDING -**Progress:** ~68% complete +**Phase:** 2.5 (WebRTC Implementation) - ⏳ NEXT +**Previous Phase:** 2 (Matches & Ratings API) - ✅ COMPLETED +**Also Completed:** 1.6 (Competition Heats System - Backend & Frontend) - ✅ COMPLETED +**Progress:** ~72% complete ### ✅ Completed - Phase 0: Frontend mockup with all views @@ -27,10 +27,22 @@ - Public profiles (/{username}) - Event participation tracking (auto-save joined events) - Event security (unique slugs, prevent ID enumeration) - - **QR code event check-in system** (physical presence required at venue) + - QR code event check-in system (physical presence required at venue) +- Phase 1.6: Competition Heats System + - Database schema (divisions, competition_types, event_user_heats) + - Backend API (CRUD operations, validation) + - Frontend components (HeatsBanner, forms, badges) +- Phase 2: Matches & Ratings API + - Match requests with CUID slugs + - Real-time match notifications + - Ratings system (1-5 stars, comments, preferences) + - Public profile ratings display + - Profile links from chat/matches + - Message history persistence + - Duplicate rating prevention ### ⏳ Next Priority -**Core Features** - Matches API + Ratings + WebRTC Signaling +**WebRTC Implementation** - P2P signaling and file transfer **See:** `docs/COMPLETED.md` for full list of completed tasks @@ -349,35 +361,12 @@ --- -## 📌 NEXT STEPS - Phase 2: Core Features +## 📌 NEXT STEPS - Phase 2.5: WebRTC Implementation -**Estimated Time:** 12-15 hours +**Estimated Time:** 8-10 hours **Priority:** HIGH -### Step 1: Matches API (3-4h) ⏳ -- [ ] Create Match controller and routes -- [ ] `POST /api/matches` - Create match request -- [ ] `POST /api/matches/:id/accept` - Accept match request -- [ ] `GET /api/matches` - List user's matches (active, pending, completed) -- [ ] `GET /api/matches/:id` - Get match details -- [ ] Frontend integration: - - Match request button in EventChatPage - - Match notification handling - - Match acceptance flow -- [ ] Unit tests (match creation, acceptance, validation) - -### Step 2: Ratings API (2-3h) ⏳ -- [ ] Create Rating controller and routes -- [ ] `POST /api/ratings` - Submit rating after collaboration -- [ ] `GET /api/users/:id/ratings` - Get user's ratings & average -- [ ] `GET /api/matches/:id/rating` - Check if match already rated -- [ ] Frontend integration: - - Update RateMatchPage to use real API - - Display user ratings on profile/active users -- [ ] Validation (1-5 stars, comment length) -- [ ] Unit tests (rating submission, retrieval, validation) - -### Step 3: WebRTC Signaling (3-4h) ⏳ +### Step 1: WebRTC Signaling (3-4h) ⏳ - [ ] Add Socket.IO signaling events: - `webrtc_offer` - Send SDP offer - `webrtc_answer` - Send SDP answer @@ -389,7 +378,7 @@ - [ ] Connection state monitoring - [ ] Unit tests (signaling message exchange) -### Step 4: WebRTC File Transfer (4-5h) ⏳ +### Step 2: WebRTC File Transfer (4-5h) ⏳ - [ ] RTCDataChannel setup (ordered, reliable) - [ ] File metadata exchange (name, size, type) - [ ] File chunking implementation (16KB chunks) @@ -502,11 +491,13 @@ git commit -m "feat: description" | Phase 0: Frontend Mockup | ✅ Done | 100% | ~8h (completed) | | Phase 1: Backend Foundation | ✅ Done | 100% | ~14h (completed) | | Phase 1.5: Email & WSDC & Profiles | ✅ Done | 100% | ~12h (completed) | -| Phase 2: Core Features | ⏳ Next | 0% | ~15-20h | +| Phase 1.6: Competition Heats | ✅ Done | 100% | ~8h (completed) | +| Phase 2: Matches & Ratings API | ✅ Done | 100% | ~10h (completed) | +| Phase 2.5: WebRTC Implementation | ⏳ Next | 0% | ~8-10h | | Phase 3: MVP Finalization | ⏳ Pending | 0% | ~15-20h | | Phase 4: Extensions | ⏳ Pending | 0% | TBD | -**Overall Progress:** ~65% (Phase 0, 1, 1.5 completed) +**Overall Progress:** ~72% (Phases 0, 1, 1.5, 1.6, 2 completed) ---