Premiere verison route admin operationnelle
This commit is contained in:
35
README_MATCHES_TEAMS.txt
Normal file
35
README_MATCHES_TEAMS.txt
Normal file
@@ -0,0 +1,35 @@
|
||||
Super Sunday — Patch matches (équipes) + colonnes de scores optionnelles
|
||||
=======================================================================
|
||||
|
||||
Ce patch aligne l’API sur ton schéma actuel :
|
||||
- `matches` utilise **team_a_id / team_b_id** (et non player_*)
|
||||
- Le statut par défaut est 'scheduled'
|
||||
- Le scoring met à jour `score_a`, `score_b`, `finished` si les colonnes existent.
|
||||
Sinon, l’API renvoie 409 'missing_columns' et tu peux ajouter les colonnes via la migration fournie.
|
||||
|
||||
Fichiers
|
||||
--------
|
||||
- backend/src/routes/matches.js (remplace l’ancien)
|
||||
- backend/sql/add_scores_columns.sql (ajoute score_a / score_b si absents)
|
||||
- apply_add_scores_columns.sh (applique la migration)
|
||||
|
||||
Installation
|
||||
------------
|
||||
1) Dézipper à la racine du projet :
|
||||
unzip -o supersunday_matches_team_columns_patch.zip -d .
|
||||
|
||||
2) (Optionnel si tu veux scorer) ajouter les colonnes de score :
|
||||
./apply_add_scores_columns.sh
|
||||
|
||||
3) Rebuild + restart API :
|
||||
docker compose build --no-cache api
|
||||
docker compose up -d api
|
||||
docker compose logs --since=2m api
|
||||
|
||||
Tests
|
||||
-----
|
||||
# Créer un match (adapte le tournament_id et les team_* si tu en as)
|
||||
curl -s -X POST http://localhost/api/matches -H "Content-Type: application/json" --data-raw '{"tournament_id":1,"team_a_id":1,"team_b_id":2,"court":"Court 1"}'
|
||||
|
||||
# Scorer (si colonnes score_* ajoutées) :
|
||||
curl -s -X POST http://localhost/api/matches/1/score -H "Content-Type: application/json" --data-raw '{"score_a":6,"score_b":4,"finished":true}'
|
||||
Reference in New Issue
Block a user