From f187b3e44e33337a513a96897651d7919cc3b5e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Gierwia=C5=82o?= Date: Sat, 29 Nov 2025 23:39:44 +0100 Subject: [PATCH] docs: update documentation with recent features - Update README.md with tier system and recent features - Add 3-tier account system (BASIC/SUPPORTER/COMFORT) to docs - Document fairness algorithm and dual buffer system - Add clickable usernames and country flags features - Update test count to 285/286 passing (99.7%) - Update database schema documentation with tier fields - Update all last modified dates to 2025-11-29 --- README.md | 34 ++++++++++++++++++++++++---------- docs/CONTEXT.md | 7 +++++-- docs/SESSION_CONTEXT.md | 20 +++++++++++++++----- docs/TODO.md | 17 ++++++++++------- 4 files changed, 54 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 8710bbe..f04d661 100644 --- a/README.md +++ b/README.md @@ -16,17 +16,19 @@ Web application (PWA) for the dance community enabling matchmaking, chat, and vi **User Profiles:** - ✅ **User Profiles** - profile editing (first name, last name, WSDC ID) - ✅ **Social Media Links** - YouTube, Instagram, Facebook, TikTok -- ✅ **Location** - country (dropdown with 195 countries) and city -- ✅ **Public Profiles** - visible to other logged-in users at /{username} +- ✅ **Location** - country (dropdown with 195 countries with flags) and city +- ✅ **Public Profiles** - visible to other logged-in users at /@{username} - ✅ **Profile Statistics** - number of matches, average rating, number of reviews +- ✅ **Clickable Usernames** - usernames in chat are clickable links to public profiles **Events & Chat:** - ✅ **Event List** - browse dance events from worldsdc.com - ✅ **Event Participation Tracking** - automatic saving of joined events -- ✅ **Real-time Event Chat** - Socket.IO chat for event participants +- ✅ **Real-time Event Chat** - Socket.IO chat for event participants with country flags - ✅ **Active Users Sidebar** - list of online users in the event - ✅ **Message History** - message persistence in database - ✅ **Infinite Scroll** - loading older messages +- ✅ **Competitor Numbers** - bib number display in event chat **Matchmaking & Private Chat:** - ✅ **Match Requests** - send and accept match requests with real-time notifications @@ -67,7 +69,16 @@ Web application (PWA) for the dance community enabling matchmaking, chat, and vi - ✅ **Dashboard** - centralized landing page with active events, matches, requests - ✅ **Online Count** - real-time users in event chat - ✅ **Unread Count** - unread message badges per match -- ✅ **Recording Matching** - auto-assign recorders for competition heats +- ✅ **Mobile-first Design** - responsive chat layout with page titles on mobile + +**Auto-matching & Account Tiers:** +- ✅ **Smart Recording Matching** - auto-assign recorders for competition heats with collision detection +- ✅ **3-Tier Account System** - BASIC (free), SUPPORTER, COMFORT tiers with fairness-based assignment +- ✅ **Fairness Algorithm** - karma tracking (recordingsDone vs recordingsReceived) for balanced workload +- ✅ **Dual Buffer System** - prep time before and rest time after dancing (no buffer for recording) +- ✅ **Tier Penalties** - SUPPORTER (-10 fairness), COMFORT (-50 fairness) for reduced recording frequency +- ✅ **Event-specific Upgrades** - accountTierOverride for temporary tier boosts (e.g., Comfort Pass) +- ✅ **Multi-criteria Sorting** - Location > Fairness > Load balancing priority - ✅ **Competitor Numbers** - bib number support for events **Security & PWA (All Implemented):** @@ -262,12 +273,14 @@ docker compose --profile dev up --build - Password Reset: reset_token, reset_token_expiry - Social: youtube_url, instagram_url, facebook_url, tiktok_url - Location: country, city + - Account Tiers: account_tier (BASIC/SUPPORTER/COMFORT), recordings_done, recordings_received 2. **events** - dance events - id, slug (unique), name, location, start_date, end_date, description, worldsdc_id, participants_count 3. **event_participants** - event participants (many-to-many) - - id, user_id, event_id, joined_at + - id, user_id, event_id, joined_at, recorder_opt_out, competitor_number + - account_tier_override (optional event-specific tier upgrade) 4. **chat_rooms** - chat rooms - id, event_id, type (event/private), created_at @@ -468,14 +481,15 @@ REPL specifics: ## 📊 Test Coverage -**Backend: 73% overall coverage** (286/286 tests passing - 100%) +**Backend: 73% overall coverage** (285/286 tests passing - 99.7%) +- **Matching Algorithm**: 30/30 tests passing (unit tests for collision detection, buffers, tier system) - **WebRTC Signaling**: 7/7 tests passing (offer/answer/ICE relay, authorization) - **Auth Controllers**: Comprehensive coverage - **Events API**: Full test suite - **Matches API**: Full CRUD tests - **Dashboard API**: 12 tests passing -- **Socket.IO**: Full WebRTC + chat coverage -- **Test Isolation**: Fixed with unique test data per suite (100% passing) +- **Socket.IO**: Full WebRTC + chat coverage (1 flaky timeout test) +- **Test Isolation**: Fixed with unique test data per suite **Frontend: Test files ready** (requires test runner setup) - WebRTC detection utility tests @@ -594,6 +608,6 @@ TBD --- -**Current Status:** MVP Complete ✅ | 286 tests passing | Ready for Production Deployment +**Current Status:** MVP Complete ✅ | 285/286 tests passing (99.7%) | Ready for Production Deployment -**Last Updated:** 2025-11-23 +**Last Updated:** 2025-11-29 diff --git a/docs/CONTEXT.md b/docs/CONTEXT.md index 152c585..96a3470 100644 --- a/docs/CONTEXT.md +++ b/docs/CONTEXT.md @@ -49,6 +49,7 @@ Browser A ←────────────────────── ## 🗃️ Modele bazy danych (Implemented) - `users`: identyfikacja, email, hasło (bcrypt), avatar, profile data + - Account tiers: `accountTier` (BASIC/SUPPORTER/COMFORT), `recordingsDone`, `recordingsReceived` - `events`: lista eventów (z worldsdc.com + manual entries) - `divisions`: competition divisions (Novice, Intermediate, Advanced, etc.) - `competition_types`: Jack & Jill, Strictly @@ -58,7 +59,9 @@ Browser A ←────────────────────── - `matches`: relacja między dwoma użytkownikami (CUID slugs for security) - `ratings`: oceny po wymianie nagraniami (1-5, komentarz, collaboration preference) - `event_participants`: tracking event participation + - Recording opt-out, competitor numbers, `accountTierOverride` (event-specific tier upgrades) - `event_checkin_tokens`: QR code check-in system +- `recording_suggestions`: auto-matching results with collision detection --- @@ -89,7 +92,7 @@ Browser A ←────────────────────── - Socket.IO 4.8.1 (WebSocket) - PostgreSQL 15 with Prisma ORM 5.8.0 - bcrypt + JWT authentication -- Jest + Supertest (286/286 tests passing, 73% coverage) +- Jest + Supertest (285/286 tests passing - 99.7%, 73% coverage) ### WebRTC - RTCPeerConnection (implemented) @@ -175,6 +178,6 @@ const wyslijWiadomosc = (wiadomosc) => { --- -**Last Updated:** 2025-11-23 +**Last Updated:** 2025-11-29 **Status:** ✅ MVP Complete - All core features implemented and tested diff --git a/docs/SESSION_CONTEXT.md b/docs/SESSION_CONTEXT.md index 134929b..559ffda 100644 --- a/docs/SESSION_CONTEXT.md +++ b/docs/SESSION_CONTEXT.md @@ -16,7 +16,7 @@ ## Current Status **Phase:** MVP Complete - Ready for Production Deployment -**Tests:** 286/286 backend tests passing (73% coverage) +**Tests:** 285/286 backend tests passing - 99.7% (73% coverage) **Next Goal:** Infrastructure setup (server, domain, SSL) ### Core Features (All Implemented) @@ -24,11 +24,15 @@ - Real-time chat (Socket.IO) - event rooms + private 1:1 - WebRTC P2P file transfer (RTCDataChannel, up to 700MB tested) - Competition heats system for matchmaking -- Recording matching system (auto-assign recorders) +- Recording matching system with 3-tier account system (BASIC/SUPPORTER/COMFORT) +- Fairness algorithm (karma tracking: recordingsDone vs recordingsReceived) +- Dual buffer system (prep before + rest after dancing) +- Clickable usernames with @ prefix, country flags - Matches & ratings API - QR code event check-in - PWA (offline support, iOS compatible) - Security: CSRF, rate limiting, account lockout +- Test bot for automated testing --- @@ -63,12 +67,13 @@ Key models: - `users` - Auth, profile, social links, location, lockout fields + - Account tiers: `accountTier` (BASIC/SUPPORTER/COMFORT), `recordingsDone`, `recordingsReceived` - `events` - Dance events with unique slugs -- `event_participants` - User-event relationship, competitorNumber +- `event_participants` - User-event relationship, competitorNumber, recorderOptOut, `accountTierOverride` - `divisions` / `competition_types` / `event_user_heats` - Competition system - `matches` - User pairings with CUID slugs - `ratings` - 1-5 stars, comments -- `recording_suggestions` - Auto-matching results +- `recording_suggestions` - Auto-matching results with collision detection - `chat_rooms` / `messages` - Real-time chat persistence --- @@ -107,6 +112,11 @@ docker compose exec backend npm test MATCH_STATUS: pending | accepted | rejected | completed SUGGESTION_STATUS: pending | accepted | rejected | not_found CONNECTION_STATE: disconnected | connecting | connected | failed +ACCOUNT_TIER: BASIC | SUPPORTER | COMFORT + +// Tier fairness penalties +FAIRNESS_SUPPORTER_PENALTY: 10 +FAIRNESS_COMFORT_PENALTY: 50 ``` --- @@ -129,4 +139,4 @@ CONNECTION_STATE: disconnected | connecting | connected | failed --- -**Last Updated:** 2025-11-23 +**Last Updated:** 2025-11-29 diff --git a/docs/TODO.md b/docs/TODO.md index 1b0b41b..1c0af5b 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -7,14 +7,17 @@ ## Current Status **Phase:** MVP Complete - Ready for Production Deployment -**Tests:** 286/286 passing (73% coverage) +**Tests:** 285/286 passing - 99.7% (73% coverage) **Status:** Awaiting infrastructure setup -### Recently Completed (2025-11-23) -- Recording Matching System (auto-assign recorders for heats) -- Competitor Number (Bib) Support -- Frontend Refactoring (component extraction, status constants) -- Dashboard with real-time updates (online count, unread messages) +### Recently Completed (2025-11-29) +- 3-Tier Account System (BASIC/SUPPORTER/COMFORT) with fairness algorithm +- Dual Buffer System (prep before + rest after dancing) +- Clickable Usernames with @ prefix in profiles +- Country Flags in Event Chat +- Mobile-first Design Improvements (page titles on mobile) +- Recording Matching System Improvements (collision detection, schedule config) +- Test Bot for Automated Testing **Full history:** See `docs/archive/COMPLETED.md` @@ -114,5 +117,5 @@ http://localhost:8080 --- -**Last Updated:** 2025-11-23 +**Last Updated:** 2025-11-29 **Full Details:** See `docs/archive/COMPLETED.md` for implementation details