Files
SuperSunday/README_MATCHES.txt
2025-08-25 12:39:54 +00:00

41 lines
1.7 KiB
Plaintext

Super Sunday — Patch routes Matches (CRUD + score)
=================================================
API ajoutée :
- POST /api/matches → créer un match
- GET /api/matches?tid=1 → lister (option tournoi)
- GET /api/tournaments/:id/matches → alias pratique
- POST /api/matches/:id/score → mettre à jour score_a/score_b/finished
- PUT /api/matches/:id → mise à jour générique (player_a_id, court, start_time, etc.)
- DELETE /api/matches/:id → supprimer un match
Fichiers
--------
- backend/src/routes/matches.js
- backend/src/index.js (montage + alias, optionnel si vous avez déjà un index)
- backend/sql/matches.sql (table matches si besoin)
- backend/sql/seed_matches.sql (seed de démo)
- apply_matches_sql.sh (applique SQL + seed)
Installation
------------
1) Dézippez à la racine du projet :
unzip -o supersunday_matches_routes_patch.zip -d .
2) (Optionnel) créer la table matches + seed :
./apply_matches_sql.sh
3) Rebuild + restart API :
docker compose build --no-cache api
docker compose up -d api
docker compose logs --since=2m api
Tests
-----
curl -s http://localhost/api/health
curl -s http://localhost/api/matches
curl -s -X POST http://localhost/api/matches -H 'Content-Type: application/json' -d '{"tournament_id":1,"court":"Court 1"}'
curl -s http://localhost/api/tournaments/1/matches
curl -s -X POST http://localhost/api/matches/1/score -H 'Content-Type: application/json' -d '{"score_a":6,"score_b":4,"finished":true}'
curl -s -X DELETE http://localhost/api/matches/1