Aggiorno documentazione e memoria di progetto per il CMS Strapi

CLAUDE.md, docs/PORTABILITA.md e mem/features/cloud-efficienza.md riflettono
che rosa/classifica/storico partite vengono ora da Strapi (non più hardcoded)
e che lo scout finalizzato viene anche inviato a Strapi, oltre al localStorage.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-28 15:40:08 +02:00
co-authored by Claude Sonnet 5
parent 839db3d4ca
commit 84313b1955
3 changed files with 22 additions and 12 deletions
+19 -11
View File
@@ -65,10 +65,11 @@ inspecting the response body and converted into `renderErrorPage()`'s HTML error
The project must remain deployable on plain Node.js + PostgreSQL, not locked into Lovable Cloud
(see `docs/PORTABILITA.md`). Concretely:
- **Never query the database from components.** All data access goes through modules in
`src/lib/*.ts` (e.g. `palloni.ts`, `mvp-voti.ts`, `eventi.ts`, `presenze.ts`, `rosa.ts`,
`scout-*.ts`) — each exports TanStack Query hooks (`useX`) wrapping `supabase.from(...)`. This
keeps the backend swappable in one place.
- **Never query the database (or the Strapi CMS) from components.** All data access goes through
modules in `src/lib/*.ts` (e.g. `palloni.ts`, `mvp-voti.ts`, `eventi.ts`, `presenze.ts`, `rosa.ts`,
`scout-*.ts`) — each exports TanStack Query hooks (`useX`) wrapping `supabase.from(...)` or, for
Strapi-backed data, `strapiFetch(...)` from `src/lib/strapi-client.ts` (see `rosa-base.ts`,
`classifica-csi.ts`, `storico-match.ts`). This keeps the backend swappable in one place.
- `src/integrations/lovable/*` (social login) is optional and unused by any screen — safe to
remove without impact.
- No provider-exclusive features: no edge functions, no Lovable-only auth as the sole login method,
@@ -92,13 +93,20 @@ load-bearing, not style preferences:
- Stats/badges/standings are "write once, read many": computed and persisted once (e.g. at match
end), never recomputed on every page open.
- Live match scouting: only the scoring user writes; everyone else reads already-saved data.
- CSI league data is currently a **hardcoded placeholder** array in `src/lib/crapp-data.ts`
(`classifica`, `storicoMatch`), explicitly marked "(demo)" in the UI — no real sync exists yet,
this is planned/open work, not an existing pattern to copy.
- A scouted match result (`ScoutMatch`, from `scout.tsx` / `scout-store.ts`) is saved **only to
the scoring device's `localStorage`** (key `crapp-scout-v1`), never to Supabase — only the
in-progress resume state goes to the `scout_live` table. So today a match result is not shared
across devices/users at all.
- Player roster, CSI league standings and match history come from a self-hosted **Strapi CMS**
(`infra/strapi/`, its own Postgres database on the same cluster as Supabase) — editing happens
only in Strapi's own admin panel (`/cms/admin`), never in app UI. The app reads them read-only via
`src/lib/rosa-base.ts` / `classifica-csi.ts` / `storico-match.ts` (long `staleTime`, no polling —
same cloud-efficiency rules apply). Player identity is the stable `codice` field (`g1`, `g2`, …)
on the Strapi `giocatore` content type, **not** Strapi's own numeric id — every Supabase table
that references a player by id (`pagelle_voti`, `cacche_partita`, MVP votes, ball-duty turns,
presenze, scout actions) keys on that string, so it must never change for an existing player.
- A scouted match result (`ScoutMatch`, from `scout.tsx` / `scout-store.ts`) is saved to the
scoring device's `localStorage` (key `crapp-scout-v1`, still the source `useRosa`/
`giocatoriConScout` read for stats) **and** pushed best-effort to Strapi's `scout-match-finale`
content type via `/api/public/scout-finale` at match end, so it becomes visible cross-device in
the admin panel — no retry if that POST fails, the local save already succeeded either way. The
in-progress resume state still goes only to the `scout_live` Supabase table, unrelated to Strapi.
- Push notifications only for high-value events (convocations, training/match reminders, ball-duty
turn, final result) — no chat/photo/video features.