mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 15:23:29 +00:00
Introduce an explicit, user-declared "I have diabetes / clinician glucose targets" preference (`User.hasDiabetes`, migration 0174, defaulted false) plus its GET/PATCH endpoint at `/api/auth/me/diabetes`. The flag selects which glucose target band a reading is judged against; it is never inferred from a value and never asserts a diagnosis. Mirrors the existing per-user-scalar preference pattern: 60/min rate limit, Zod validation, audit-logged, field-by-field write. OpenAPI regenerated for the new route.
16 lines
785 B
SQL
16 lines
785 B
SQL
-- v1.18.6 — diabetes opt-in for clinician glucose targets.
|
||
--
|
||
-- One additive, defaulted column on `users` so a user can declare "I have
|
||
-- diabetes / clinician glucose targets". When `true`, the glucose target
|
||
-- resolver applies the tighter ADA glycemic GOAL bands (fasting 80–130,
|
||
-- postprandial < 180) instead of the general non-diabetic normal bands.
|
||
--
|
||
-- This is NEVER auto-inferred from a reading and is NEVER a diagnosis — it is
|
||
-- a user-declared preference that only selects which target band the user is
|
||
-- judged against. The default `false` backfills every existing row onto the
|
||
-- general bands (the current behaviour), so the migration is a no-op for
|
||
-- anyone who never opts in.
|
||
|
||
ALTER TABLE "users"
|
||
ADD COLUMN "has_diabetes" BOOLEAN NOT NULL DEFAULT false;
|