Commit Graph
25 Commits
Author SHA1 Message Date
davideandClaude Opus 5 764f75085e Sync roadmap and project state with the code
Mark medical certificates, admin dashboard and CSV export as done: the
player-side profile screens exist, so the notes calling them missing were
stale. Leave CSI membership and official calendar open, each with what is
already there.

Record the current dev state of Google auth: implemented but returning
"provider is not enabled" until the provider is turned on in Supabase.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-30 22:47:55 +02:00
davideandClaude Opus 5 9e17c2fadd DD-017: l'admin scrive al posto del giocatore
Registra la decisione prima del codice, come chiede AGENTS.md.

Il modello dei permessi passa da "ognuno i suoi" a "ognuno i suoi, più l'admin
su tutti, tranne i file": senza, l'export per il tesseramento resta incompleto e
il lavoro amministrativo torna in chat, contro la missione del progetto. Gli
upload restano al giocatore perché su documenti d'identità e dati sanitari la
catena di responsabilità deve restare leggibile.

Aggiornati di conseguenza il documento di modulo (utenti, azioni della
dashboard, permessi) e il changelog. Annotato nel riesame che oggi non esiste
audit di chi modifica un dato.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-30 18:15:16 +02:00
davideandClaude Opus 5 53b2252997 Test sulla validazione dei dati squadra
Copre i controlli che evitano un errore Postgres di ritorno: nome, cognome e
ruolo non vuoti, numero di maglia intero e positivo (il CHECK della tabella), e
il rilevamento di un numero già assegnato a un altro giocatore attivo.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-30 18:15:16 +02:00
davideandClaude Opus 5 718ef09dfa L'amministratore può modificare i dati dei giocatori
Attua DD-017. La scheda della dashboard era di sola lettura: ora l'admin apre il
giocatore e modifica.

- Dati squadra (nome, cognome, numero, ruolo): le docs li assegnavano già agli
  amministratori, ma non esisteva nessuna schermata per cambiarli.
- Dati personali e del documento: compilabili al posto del giocatore, perché un
  export CSI incompleto rimanda il lavoro in chat.
- Scollega account: libera uno slot assegnato per errore, come previsto da
  DD-016 regola 2.

I file restano fuori: l'admin li scarica ma non li carica al posto di altri.

Nessuna migration: le policy di M1 e M2 riconoscevano già l'admin. I campi del
profilo diventano un componente condiviso (CampiProfilo) tra la schermata del
giocatore e la dashboard, con gli upload passati come slot: da admin quelle
righe non compaiono.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-30 18:15:16 +02:00
davideandClaude Opus 5 3f52e9cc54 Documenta dashboard admin, profili e ambiente locale
Checklist "Fine lavoro" di AGENTS.md per il lavoro dei due commit precedenti.

- DATABASE.md: profili_giocatore creata, user_roles come fonte dei permessi, e
  la nuova sezione Storage per il bucket privato.
- ARCHITECTURE.md: autenticazione e ruoli tra i punti fermi, comandi dello stack
  Supabase locale; gli stessi comandi in CLAUDE.md.
- CHANGELOG.md: la voce è marcata come presente su develop e non ancora in
  produzione.
- PROJECT_STATE.md: i cinque passaggi per attivare login e dashboard in
  produzione, in ordine, con il redirect URI di Google e la query per il primo
  admin. Segnalato che dev e produzione condividono lo stesso database.
- TODO.md: la dashboard esce dal backlog; entra il profilo lato giocatore, senza
  il quale la dashboard resterebbe senza dati.
- modules/profilo-giocatore.md: registrate due scelte fatte in corso d'opera —
  solo Google al posto di "Google oppure Email", e "Visualizza profilo" come
  scheda in linea invece di una schermata separata.

ROADMAP.md resta con la casella non spuntata: la funzionalità è su develop, non
ancora rilasciata.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-30 17:58:24 +02:00
davideandClaude Opus 5 255afde48e Test per profili, ruoli e permessi sul database
Copre le parti nuove e una trappola che sarebbe passata inosservata.

- unit: completamento del profilo (30/30/30/10), stato di scadenza dei
  documenti, export CSV, conversione riga <-> modello, anagrafica di squadra.
- unit: risoluzione dei permessi admin, incluso il fatto che con una sessione
  attiva decide il database e la lista di nomi non conta più.
- integration (schema-profili): verifica su un database vero le colonne che il
  codice legge, il bucket privato e la chiusura verso l'utente anonimo.
- e2e: /admin entra nell'elenco delle schermate verificate.

schema-profili tenta scritture da anonimo per dimostrare che la RLS le respinge,
e poi rilegge la riga: su un UPDATE che tocca zero righe PostgREST risponde 2xx,
quindi fidarsi del codice di risposta darebbe un falso verde. Si salta da solo
dove M2/M3 non sono ancora applicate, indicandolo nel motivo.

Verificato: 8/8 contro lo stack locale (che ha M2/M3), 21/21 file con
npm run test:all contro il progetto cloud.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-30 17:58:12 +02:00
davideandClaude Opus 5 da51517ffc Dashboard amministratore e profilo per il tesseramento
Implementa la voce "Dashboard amministratore" della roadmap v1.1, come descritta
in docs/modules/profilo-giocatore.md, insieme alla parte di profilo che la
alimenta.

- /admin: stato dei profili della squadra, download di documento, certificato e
  foto tessera, export CSV con i 12 campi del tesseramento CSI. Un certificato
  scaduto non conta come valido.
- Profilo giocatore: dati personali, documento (fronte e retro), certificato e
  foto tessera, con widget di completamento in Home che sparisce al 100%.
- I permessi di amministrazione arrivano da user_roles (DD-011) e non più dalla
  lista di nomi in crapp-data.ts, che resta come ponte finché
  VITE_AUTH_OBBLIGATORIA non viene acceso in produzione.
- Login Google via Supabase Auth: al primo accesso l'account si collega a uno
  slot libero di giocatori_squadra, e il vincolo lo fa rispettare il trigger di
  M1 (DD-016 regola 2).

Migration additive: M2 crea profili_giocatore, M3 il bucket privato
profili-giocatore. Nessuna tabella v1.0 viene toccata, quindi si possono
applicare senza cambiare il comportamento attuale dell'app.

supabase/config.toml e seed.sql configurano lo stack locale: serve perché il
progetto Supabase è uno solo, condiviso tra sviluppo e produzione.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-30 17:57:59 +02:00
davideandClaude Opus 5 ea29f053e3 Enable the claude-md-management plugin for the repo
Adds .claude/settings.json so every clone gets the same Claude Code
plugins: the official vercel and supabase ones already in use locally,
plus claude-md-management for maintaining CLAUDE.md.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-30 16:34:38 +02:00
davideandClaude Opus 5 e1e8dd5415 Reorganize documentation and unify the AI assistant rules
Documentation:
- Add docs/README.md, the documentation index that AGENTS.md pointed to as the
  first file to read but which did not exist.
- One home per piece of information: the feature list stays in ROADMAP.md,
  CHANGELOG.md records only when something shipped, TODO.md only ongoing work.
  Reconcile the entries that had drifted (CSI was both done and pending;
  pagelle, badge social and serie were missing from the roadmap).
- Rewrite DATABASE.md as tables: add giocatori_squadra (already created by a
  migration) and profili_giocatore (planned in DD-016), fix the wrong heading
  levels, drop the duplicated roadmap.
- DESIGN_DECISIONS.md: move the index to the top and sort it, extract the
  template into _template-dd.md.
- ARCHITECTURE.md becomes the technical reference; CLAUDE.md no longer
  duplicates it.
- Add docs/EFFICIENZA_CLOUD.md with the rules previously kept in mem/,
  separating what the code enforces from the goals not yet implemented.
- Fix statements the code contradicted: mutations use setQueryData rather than
  invalidateQueries, and scout_sessioni and giocatori_squadra are not read by
  the code yet.
- Track the v1.0 modules with no spec in docs/modules/ from TODO.md.

AI assistants:
- AGENTS.md is the single source of the rules, now including the technical
  constraints only Claude Code knew about (generated files, Vite plugins, data
  access) and an end-of-work checklist that applies to every assistant.
- CLAUDE.md and .cursor/rules/crapp.mdc point to AGENTS.md instead of
  restating it.
- Remove the five .cursor/*.md files, which Cursor never loaded.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-30 16:26:14 +02:00
davideandClaude Opus 5 c06b33e83b Document how to run the tests.
test/README.md covers the commands, what each folder verifies, whether it
needs the network, and the one real limit: the app renders after
hydration, so the end-to-end tests check HTTP responses and the data
behind the pages, not the rendered interface.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-30 13:07:59 +02:00
davideandClaude Opus 5 9ca124a868 Expire a scout session whose timestamp cannot be read.
sessioneScaduta compared Date.now() against NaN when aggiornato_il was
not a valid date, and every comparison with NaN is false: the session
was reported as still active, so the Scout Live table stayed locked to a
player who could no longer release it.

An unreadable timestamp now frees the session, which is the safe
direction: at worst someone takes over a scouting session that was
already unattended.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-30 13:07:59 +02:00
davideandClaude Opus 5 af563603f9 Add a test suite for the domain logic and the server routes.
The project had no automated verification at all, so the "Test" step in
the AGENTS.md workflow rested entirely on clicking through the app.

The suite runs on bun with node:assert and adds no dependency: every file
is a script that exits non-zero when a check fails, and test/run.ts runs
each one in its own process. Unit tests cover the rules that decide what
players see (badges, streaks, ball duty rotation, ratings, MVP ties,
scouting totals, goals, notifications, CSI parsing); integration and
end-to-end tests drive the real dev server. Nothing writes to the
database, so both can be pointed at a live environment.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-30 13:07:41 +02:00
davideandClaude Opus 5 fee3d0b55a Read the official standings and results from the CSI portal.
The Campionato page showed hardcoded demo data. It now reads the real
2025/26 season (Campionato Open Misto Eccellenza, project 767, team
3359, Girone B) from the Livescore CSI Bologna portal.

The portal has no documented API: we call the same endpoints its own
pages call over ajax, so parsing must degrade gracefully. A single
server route fetches them, caches for 6 hours and serves the last good
payload on failure; the page falls back to the previous data when
nothing is available. No browser ever contacts the portal, keeping the
request count independent of how many players open the app.

Also fixes the header, which claimed "Girone C - CSI Milano".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-30 12:23:12 +02:00
davide baaffc66db Add CLAUDE.md guide for Claude Code sessions. 2026-08-30 12:23:12 +02:00
Ivan Cacciari 7d16bdba75 Update project state and Supabase configuration 2026-08-30 12:16:20 +02:00
Ivan CacciariandCursor 7b4bfe8b27 Add M1 migration for giocatori_squadra roster table.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-28 17:27:58 +02:00
Ivan CacciariandCursor 32782227f4 Record approved F0 player profile data schema as DD-016.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-28 17:00:28 +02:00
Ivan CacciariandCursor 57b36b5a09 Reference DESIGN_DECISIONS.md in AGENTS.md for AI and contributors.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-28 16:33:32 +02:00
Ivan Cacciari 19e1bb0790 Add AI documentation and project governance 2026-08-07 19:42:21 +02:00
Ivan Cacciari 7a2b26ec89 Add project documentation and AI development guidelines 2026-08-07 15:36:02 +02:00
Ivan Cacciari 6dc63d9250 Test branch develop 2026-08-07 12:23:27 +02:00
Ivan Cacciari c99f444652 correzione schermata benvenuto 2026-08-07 11:41:04 +02:00
Ivan Cacciari 647e13d0e5 Test deploy automatico 2026-08-07 11:18:51 +02:00
Ivan Cacciari 6ed7546e7a Test deploy automatico 2026-08-06 19:53:15 +02:00
Ivan Cacciari 330669176d Initial independent version of CrAPP 2026-08-06 08:36:47 +02:00