Files
SuperSunday/README_DELETE_TOURNAMENT.txt
2025-08-24 23:47:39 +00:00

35 lines
1.3 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 — API patch: DELETE /api/tournaments/:id (+GET/POST)
================================================================
Ce patch ajoute la route **DELETE /api/tournaments/:id** (et fournit GET/POST
si besoin) côté backend Node/Express, sans rien changer au Dockerfile.
Fichiers ajoutés/mis-à-jour
---------------------------
- backend/src/db.js (connexion PG via env)
- backend/src/routes/tournaments.js (GET, POST, DELETE)
- backend/src/index.js (monte /api/tournaments + /api/health)
Installation
------------
1) Dézipper à la racine du projet :
unzip -o supersunday_api_delete_tournament_patch.zip -d .
2) Rebuild + restart API (pas besoin de toucher à web/nginx) :
docker compose build --no-cache api
docker compose up -d api
docker compose logs --since=1m api
3) Test rapide :
curl -i http://localhost/api/health
curl -s http://localhost/api/tournaments
curl -i -X DELETE http://localhost/api/tournaments/1
Notes
-----
- Si votre schéma na pas de `ON DELETE CASCADE`, le handler supprime dabord
`matches` puis `participants` avant la ligne `tournaments`.
- Les noms de tables supposés : tournaments(id, name, location, start_date, end_date),
participants(tournament_id, full_name), matches(tournament_id, ...).
Adaptez si vos noms différent et relancez.