Files
servesync-demo/PROGRESS.md

142 lines
5.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ServeSync Demo — Court Manager Dashboard v2 🏓
**Rebuilt by Nemo on 2026-03-19**
## Live URLs
- **App:** http://192.168.1.167:8092
- **API Docs:** http://192.168.1.167:8092/api/docs
- **Gitea:** http://192.168.1.159:3000/kibin/servesync-demo
## What Changed (v2 Rebuild)
Complete rewrite from player-facing app to **single Court Manager dashboard**.
## Architecture
- Backend: FastAPI + PostgreSQL + Redis + WebSocket
- Frontend: Vue 3 + Vite + Tailwind CSS + Pinia
- Nginx: reverse proxy (baked Dockerfile, no bind mounts)
- Deploy: Gitea push → Coolify CI/CD auto-deploy
## Features Built
### Feature 1: Player Management `/players`
- Add new player (name, contact, skill level: Beginner/Intermediate/Advanced/Elite)
- Edit player profile + skill
- View player list with stats (matches played, W/L, current ELO)
- Delete player
- Table sorted by ELO descending
### Feature 2: Court Reservation `/courts`
- View all 4 courts with status (Available/In Use/Reserved/Maintenance)
- Manual status override (4 quick buttons per court)
- Reserve a court: group name, start/end time, notes
- Delete reservation
- 2-column grid layout
### Feature 3: Match Event Builder `/events/new` (3-step wizard)
**Step 1 — Event Setup:**
- Event name
- Format toggle: Singles / Doubles
- Courts count input
- Player selection from roster (multi-select)
- Real-time stage calculation preview:
- Teams count, suggested stages, elimination rounds
- Auto-updates stage config suggestions
**Step 2 — Stage Configurator:**
- Auto-generated stage cards based on calculation
- Editable: name, match type, rounds, advance count
- Add/remove stages
- Match types: Open Match, Skill-Based, Round Robin, Tournament
**Step 3 — Done!**
- Creates event → adds players → creates stages → generates brackets
- Redirects to event control panel
### Feature 4: Live Court View `/` (Main Dashboard)
- 2×2 court grid with real-time status
- Each court: name, type, status badge, current match, score, elapsed time
- Inline score entry from dashboard
- Start queued matches from "Upcoming" panel
- Active event banner with quick link
- 5-second auto-refresh
### Event Control Panel `/events/:id`
- Stage tabs (pending/active/completed)
- Matches listed by round with status
- Enter score → auto-advances bracket (places winner in next match)
- Start match → auto-assigns available court
- Manual court reassign
- Player list sidebar
- Bracket summary for tournament stages
- Start/Complete event controls
### Screen View `/screen/:courtId`
- Full-screen TV display (no nav bar)
- Giant player names and score
- Elapsed timer
- Court status display
- 3-second refresh
- Bottom nav for court switching
## Backend API
```
GET /api/players/ List all players (sorted by ELO)
POST /api/players/ Add player
GET /api/players/:id Get player
PUT /api/players/:id Update player
DELETE /api/players/:id Delete player
GET /api/courts/ List all courts + reservations
POST /api/courts/ Create court
PATCH /api/courts/:id/status Update court status
GET /api/courts/:id/reservations
POST /api/courts/:id/reservations Create reservation
DELETE /api/courts/reservations/:id
GET /api/events/ List all events
POST /api/events/ Create event
GET /api/events/calculate Stage calculation (GET with params)
GET /api/events/:id Get full event detail (stages, matches, players)
PUT /api/events/:id Update event
POST /api/events/:id/players Add player to event
DELETE /api/events/:id/players/:pid Remove player
POST /api/events/:id/stages Add stage
PUT /api/events/:id/stages/:sid Update stage
POST /api/events/:id/stages/:sid/generate Generate matches
POST /api/events/:id/start Start event (activates first stage)
POST /api/events/:id/complete Mark event complete
GET /api/matches/:id Get match detail
POST /api/matches/:id/start Start match (auto-assigns court)
POST /api/matches/:id/score Enter score (auto-advances bracket, updates ELO)
PATCH /api/matches/:id/court Assign/reassign court
GET /api/dashboard/ Live court view data
GET /api/dashboard/screen/:id TV display data
POST /api/admin/seed Re-seed demo data
WS /ws/dashboard Dashboard WebSocket
WS /ws/screen/:id Screen WebSocket
```
## Seed Data
- **8 Players:** Marco (Elite 1852), Ana (Advanced 1645), Carlos (Advanced 1583),
Diana (Intermediate 1402), Lisa (Intermediate 1318), Tony (Intermediate 1281),
Maria (Beginner 947), Jake (Beginner 883)
- **4 Courts:** A, B (Sport Court Premium), C, D (Cushioned Tournament Grade)
- **Court C & D:** In-use (live semifinal matches)
- **Reservations:** Court A reserved today 2pm, Court B maintenance tomorrow
- **Event 1:** "Spring Singles Open" — Completed, full bracket history
- **Event 2:** "Summer Tournament" — Active, Round 2 semifinals in progress
## Coolify
- App UUID: `ycw8wg8gk08gwcwc8wwwwww8`
- CI/CD: Gitea push → auto-deploy
- DB volume: `pgdata` (persistent)
## Re-seed
```bash
curl -X POST http://192.168.1.167:8092/api/admin/seed
```