Give Sokko TCG's server files headers that explain their role, callers and pitfalls

Each core file of services/cards now says where it sits, its entry points,
who calls it and what to watch for: admin checks living in the service, the
methods added to ExpeditionService and TeamService by Object.assign, the
InTx suffix, settings defaults that do not change an existing database, and
rules shared with the browser.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-12-01 09:47:18 +01:00
parent 22b397ebfa
commit 73bd5ae21c
29 changed files with 291 additions and 73 deletions

View file

@ -1,5 +1,16 @@
/**
* @file Encapsule la base SQLite et les migrations du mini-jeu Sokko TCG.
* @file Base SQLite de Sokko TCG : ouverture (clés étrangères, WAL), migrations versionnées et transactions.
*
* Contexte : couche la plus basse du serveur TCG, avec `node:sqlite` (synchrone, sans dépendance).
* Points d'entrée : `MIGRATIONS` (liste ordonnée), `CardsDatabase` (`db`, `transaction(callback)`, `close()`).
* Utilisé par : api.js, qui l'ouvre une fois ; service.js et ses sous-services, par `database.transaction` et `db`.
* Attention :
* - La version d'une migration est sa position dans `MIGRATIONS` (table `schema_migrations`). On ajoute à la
* fin ; on ne modifie, ne retire ni ne réordonne jamais une migration livrée.
* - Une migration qui reconstruit une table référencée s'écrit `{ sql, withoutForeignKeys: true }`.
* - `transaction()` n'est pas réentrante : ne pas l'appeler depuis une autre transaction.
* - Un retour au commit précédent ne défait pas une migration (voir « Retour arrière » de docs/DELIVERY.md).
* @see docs/STORAGE_SCHEMA.md
*/
import { mkdirSync } from "node:fs";