mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 13:01:00 +00:00
feat(api): publish the setup state on the account payload, and read it
Additive: `onboarding` carries the nine steps with their status, the answers as given, the flow's own completion stamp and the one task it offered. Always present — a record that never entered the flow reads as empty answers with nine pending steps, so a client branches on the statuses rather than on whether the field exists, and an unknown step id is skipped rather than refused. It is resolved for the CALLER's own record rather than for the active one, unlike the two module fields beside it. The three write routes are actor-only, and publishing a setup state the browser cannot write would be a read it could act on and never complete. Both ends land here, because a field with no reader is the failure this repository keeps rediscovering. The getting-started checklist orders its rows from the answers — medication first for somebody who takes one daily, the data-source row first for somebody who named a wearable — and it stays on screen while the flow is unfinished. That is the second half: five readings were never evidence that the setup finished, and now a pending step, an unconfirmed set of answers or an offered task that produced nothing keeps the list where it is. The ordering only applies once the answers are confirmed. Re-ordering the dashboard under somebody who is still mid-question would be movement they did not ask for.
This commit is contained in:
1 parent
021ea8f1ff
commit
dbfad0f28e
7 files changed
+852
-35
No files matched your search
@@ -34,6 +34,7 @@ import {
|
||||
inviteManagedProfileGuardianSchema,
|
||||
updateManagedProfileSchema,
|
||||
} from "@/lib/validations/managed-profiles";
|
||||
import { onboardingStateResource } from "./onboarding";
|
||||
import { moduleAccessMap } from "./profile";
|
||||
import { dataEnvelope, errorEnvelope, stdResponses } from "./shared";
|
||||
|
||||
@@ -462,6 +463,14 @@ const accountPayload = z
|
||||
notificationPrefs: z.looseObject({
|
||||
medication: z.looseObject({ clientManaged: z.boolean() }),
|
||||
}),
|
||||
// v1.39 (C1) — enumerated for the same reason `notificationPrefs` is: a
|
||||
// client DECIDES on it. The getting-started checklist orders its rows from
|
||||
// `needs` and stays on screen while the flow is unfinished, and a future
|
||||
// native client renders the steps it knows. Always present, resolved for
|
||||
// the CALLER's own record rather than the active one — the three write
|
||||
// routes are actor-only, and publishing a setup state the caller cannot
|
||||
// write would be a read a browser could act on and never complete.
|
||||
onboarding: onboardingStateResource,
|
||||
})
|
||||
.meta({
|
||||
id: "AccountPayload",
|
||||
|
||||
Reference in new issue
Block a user