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

36 lines
1.5 KiB
Plaintext
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.
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}'