mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-18 08:02:12 +00:00
Users can now tell the assistant about themselves in an encrypted free-text profile that feeds the coach and briefing prompts as clearly fenced context, with the coach allowed one targeted follow-up question when the picture is incomplete. Operators on closed registrations can mint expiring invite links with a QR code from the admin area; a valid invite opens registration exactly as many times as it allows and records who redeemed it. A nightly pass watches three deterministic signals — low adherence, blood pressure above its target band, a falling recovery trend — and sends at most one coach nudge per week through the existing notification channels, gated behind the same opt-outs as every other assistant surface.
23 lines
987 B
SQL
23 lines
987 B
SQL
-- v1.15.20 — user-authored "about me" self-description for the AI surfaces.
|
|
--
|
|
-- 1:1 with users, lazily created on first save. The free text is encrypted
|
|
-- at rest (AES-256-GCM through the shared Bytes codec, the CoachFact
|
|
-- precedent) — `about_me_encrypted` carries the `"<keyId>.<base64>"`
|
|
-- ciphertext as UTF-8 bytes and is NULL when the user cleared (or never
|
|
-- wrote) the text. Additive + non-destructive.
|
|
CREATE TABLE "user_health_profiles" (
|
|
"id" TEXT NOT NULL,
|
|
"user_id" TEXT NOT NULL,
|
|
"about_me_encrypted" BYTEA,
|
|
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"updated_at" TIMESTAMP(3) NOT NULL,
|
|
|
|
CONSTRAINT "user_health_profiles_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
CREATE UNIQUE INDEX "user_health_profiles_user_id_key" ON "user_health_profiles"("user_id");
|
|
|
|
ALTER TABLE "user_health_profiles"
|
|
ADD CONSTRAINT "user_health_profiles_user_id_fkey"
|
|
FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|