Premiere verison route admin operationnelle

This commit is contained in:
karim hassan
2025-08-25 12:39:54 +00:00
parent eabd0aa50f
commit 38ea5c7da0
21 changed files with 692 additions and 53 deletions

35
README_MATCHES_TEAMS.txt Normal file
View File

@@ -0,0 +1,35 @@
Super Sunday — Patch matches (équipes) + colonnes de scores optionnelles
=======================================================================
Ce patch aligne lAPI 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, lAPI renvoie 409 'missing_columns' et tu peux ajouter les colonnes via la migration fournie.
Fichiers
--------
- backend/src/routes/matches.js (remplace lancien)
- 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}'