mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 15:23:29 +00:00
fix(illness,sleep): document the sleep average DTO and gate the recovery driver
Add averagePerNight to the SleepRhythmResource OpenAPI schema so the new average-per-night card's field is part of the iOS-consumed contract (the endpoint already returned it; the Zod source had not been updated, so the in-sync check could not catch the omission). Tag each vital return with whether it deviated in the illness-adverse direction and tally only adverse returns when naming the recovery driver, so a neutral move (e.g. weight drift) can no longer be surfaced as the vital someone recovered ahead of.
This commit is contained in:
1 parent
b9f396c72a
commit
e2ce064254
5 files changed
+116
-6
No files matched your search
@@ -322,10 +322,26 @@ const chronotypeResource = z.object({
|
||||
.describe("Free-day nights still needed before a band is asserted."),
|
||||
});
|
||||
|
||||
const averageSleepResource = z.object({
|
||||
state: z.enum(["partial", "ready"]),
|
||||
averageMinutes: z
|
||||
.number()
|
||||
.int()
|
||||
.nonnegative()
|
||||
.describe("Mean asleep minutes per scorable night (0 while partial)."),
|
||||
nightsCounted: z.number().int().nonnegative(),
|
||||
nightsUntilReady: z
|
||||
.number()
|
||||
.int()
|
||||
.nonnegative()
|
||||
.describe("Scorable nights still needed before the average is asserted."),
|
||||
});
|
||||
|
||||
const sleepRhythmResponse = z
|
||||
.object({
|
||||
sleepDebt: sleepDebtResource,
|
||||
chronotype: chronotypeResource,
|
||||
averagePerNight: averageSleepResource,
|
||||
})
|
||||
.meta({
|
||||
id: "SleepRhythmResource",
|
||||
|
||||
Reference in new issue
Block a user