Premiere verison route admin operationnelle
This commit is contained in:
40
README_MATCHES.txt
Normal file
40
README_MATCHES.txt
Normal file
@@ -0,0 +1,40 @@
|
||||
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
|
||||
Reference in New Issue
Block a user