35 lines
1.3 KiB
Plaintext
35 lines
1.3 KiB
Plaintext
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 n’a pas de `ON DELETE CASCADE`, le handler supprime d’abord
|
||
`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.
|