feat(symptoms): add person-defined symptoms and timestamped occurrences

A symptom of one's own ("aura", "headache") is a definition with an
encrypted name and an icon from the cycle custom-symptom allowlist; each
occurrence carries a time, a 0-10 intensity (the pain score's scale), an
optional encrypted note and an optional link to one of the record's open
illness episodes. Both ride the illness module: every route answers
illness.disabled when it is off.

- Migration 0369 (idempotent): symptom_definitions and symptom_events,
  intensity CHECK 0-10, episode link ON DELETE SET NULL.
- /api/symptoms/definitions{,/[id]} and /api/symptoms/events{,/[id]}:
  eight active definitions per record (a hidden one frees its slot,
  showing it again re-checks), hide or purge, events create/list/edit/
  delete, a new link must name an open episode of the same record
  (422 symptoms.episode.notOpen). Error group symptoms.*.
- Sharing: reads at READ, logging an occurrence at WRITE, defining and
  editing at MANAGE; C1/C3/C4 audit details; frozen lists, the handler
  matrix and the activity verbs updated.
- Both encrypted columns registered and rotated; both models in the wipe
  plan; both carried at both backup ends with occurrences nested in their
  definition, plaintext in a portable file and ciphertext in a recovery
  file, and a link to an episode the file lacks dropped and named
  (symptomEpisodeReference).
- OpenAPI regenerated.
This commit is contained in:
Marc-André Bombeck committed 2026-10-03 21:13:45 +02:00
1 parent 7cd323499e
commit d6571c4e9c
30 files changed
+3091 -16

No files matched your search

+11
View File
@@ -95,6 +95,10 @@ export const BACKED_UP_MODELS = [
"IllnessEpisode",
"IllnessDayLog",
"IllnessSymptomLink",
// v1.40 — the person's own symptoms and every occurrence of them. Nothing
// else holds either; a restore without them loses the history outright.
"SymptomDefinition",
"SymptomEvent",
"EcgRecording",
"UserHealthProfile",
"HealthProfileFactRevision",
@@ -250,6 +254,10 @@ export const BACKUP_WRITER_FILES: readonly string[] = [
// because that reference is a pointer between two independently carried
// tables and not a parent-child ride.
"src/lib/export/ecg-backup.ts",
// The person's own symptoms, both ends beside each other; the occurrences
// ride inside their definition (`include: { events }` out, `events: {
// create }` back), the way a medication's side effects do.
"src/lib/export/symptoms-backup.ts",
"src/lib/cycle/backup.ts",
];
@@ -268,6 +276,7 @@ export const BACKUP_RESTORE_FILES: readonly string[] = [
"src/lib/export/environment-backup.ts",
"src/lib/export/onboarding-backup.ts",
"src/lib/export/ecg-backup.ts",
"src/lib/export/symptoms-backup.ts",
"src/lib/cycle/backup.ts",
];
@@ -308,6 +317,8 @@ export const TWO_ENDED_MODELS = [
"IllnessEpisode",
"IllnessDayLog",
"IllnessSymptomLink",
"SymptomDefinition",
"SymptomEvent",
"UserHealthProfile",
"HealthProfileFactRevision",
"CycleProfile",