From ac4d84f386b896013112054af17ee215dc18245d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Fri, 5 Jun 2026 01:07:27 +0200 Subject: [PATCH] feat(mood): seed a rated family factor in the mood catalog The family factor existed only as a binary tag; add a rated factor_family (scale 1..5, not inverse) under the factors category so it can be scored per entry. Additive seed, read dynamically by the tag catalog. --- messages/de.json | 3 ++- messages/en.json | 3 ++- messages/es.json | 3 ++- messages/fr.json | 3 ++- messages/it.json | 3 ++- messages/pl.json | 3 ++- .../0120_v1120_mood_factor_family/migration.sql | 17 +++++++++++++++++ 7 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 prisma/migrations/0120_v1120_mood_factor_family/migration.sql diff --git a/messages/de.json b/messages/de.json index 56424d29e..01f86b281 100644 --- a/messages/de.json +++ b/messages/de.json @@ -573,7 +573,8 @@ "factorSocial": "Soziales", "factorSleepQuality": "Schlafqualität", "factorStress": "Stress", - "factorConflict": "Konflikt" + "factorConflict": "Konflikt", + "factorFamily": "Familie" } }, "medications": { diff --git a/messages/en.json b/messages/en.json index 15d380056..d9a6e01b2 100644 --- a/messages/en.json +++ b/messages/en.json @@ -573,7 +573,8 @@ "factorSocial": "social", "factorSleepQuality": "sleep quality", "factorStress": "stress", - "factorConflict": "conflict" + "factorConflict": "conflict", + "factorFamily": "family" } }, "medications": { diff --git a/messages/es.json b/messages/es.json index 1949ec493..2dc15688b 100644 --- a/messages/es.json +++ b/messages/es.json @@ -573,7 +573,8 @@ "factorSocial": "vida social", "factorSleepQuality": "calidad del sueño", "factorStress": "estrés", - "factorConflict": "conflicto" + "factorConflict": "conflicto", + "factorFamily": "familia" } }, "medications": { diff --git a/messages/fr.json b/messages/fr.json index b9d7892d7..b85affb7c 100644 --- a/messages/fr.json +++ b/messages/fr.json @@ -573,7 +573,8 @@ "factorSocial": "vie sociale", "factorSleepQuality": "qualité du sommeil", "factorStress": "stress", - "factorConflict": "conflit" + "factorConflict": "conflit", + "factorFamily": "famille" } }, "medications": { diff --git a/messages/it.json b/messages/it.json index ec384b607..f20349f8f 100644 --- a/messages/it.json +++ b/messages/it.json @@ -573,7 +573,8 @@ "factorSocial": "vita sociale", "factorSleepQuality": "qualità del sonno", "factorStress": "stress", - "factorConflict": "conflitto" + "factorConflict": "conflitto", + "factorFamily": "famiglia" } }, "medications": { diff --git a/messages/pl.json b/messages/pl.json index b0e1982b5..7a5ee5662 100644 --- a/messages/pl.json +++ b/messages/pl.json @@ -573,7 +573,8 @@ "factorSocial": "życie towarzyskie", "factorSleepQuality": "jakość snu", "factorStress": "stres", - "factorConflict": "konflikt" + "factorConflict": "konflikt", + "factorFamily": "rodzina" } }, "medications": { diff --git a/prisma/migrations/0120_v1120_mood_factor_family/migration.sql b/prisma/migrations/0120_v1120_mood_factor_family/migration.sql new file mode 100644 index 000000000..ac7544753 --- /dev/null +++ b/prisma/migrations/0120_v1120_mood_factor_family/migration.sql @@ -0,0 +1,17 @@ +-- v1.12.0 — add a rated `factor_family` to the mood factor catalog. +-- +-- Follow-up to 0119: the operator asked for a "family" rating, and `family` +-- existed only as a BINARY tag. This seeds a sixth RATED factor under the +-- existing `factors` category (`mtc_factors`), scale 1..5, not inverse +-- (higher = a better family day). Strictly additive — no schema change, the +-- catalog is read dynamically by `GET /api/mood/tags`, so iOS and web pick +-- it up with no client change. Deterministic id + ON CONFLICT upsert keep +-- the seed idempotent, mirroring 0119. + +INSERT INTO "mood_tags" + ("id", "category_id", "key", "label_key", "icon", "sort_order", "is_active", "kind", "scale_min", "scale_max", "inverse") +VALUES ('mt_factor_family', 'mtc_factors', 'factor_family', 'mood.tag.factorFamily', 'Home', 5, true, 'RATED', 1, 5, false) +ON CONFLICT ("key") DO UPDATE SET + "category_id" = EXCLUDED."category_id", "label_key" = EXCLUDED."label_key", "icon" = EXCLUDED."icon", + "sort_order" = EXCLUDED."sort_order", "kind" = EXCLUDED."kind", "scale_min" = EXCLUDED."scale_min", + "scale_max" = EXCLUDED."scale_max", "inverse" = EXCLUDED."inverse";