revert(insights): drop hydration logging

Remove the in-app water-intake logging feature: the WATER_INTAKE
measurement type, the per-user daily-goal field, the goal-ring card and
its endpoint, and the related query keys, OpenAPI route, and locale
strings. The feature is dropped from this release; the baseline-drift,
breathing-screening, and labs-changes insight cards are unaffected, and
the pre-existing TOTAL_BODY_WATER body-composition type stays intact.
This commit is contained in:
Marc-André Bombeck committed 2026-06-28 11:39:26 +02:00
1 parent ec3fcea84f
commit 4bf45efcab
32 files changed
+6 -1136

No files matched your search

-1
View File
@@ -77,7 +77,6 @@ const openApiBase: Pick<
{ name: "Illness" },
{ name: "Admin" },
{ name: "Meta" },
{ name: "Hydration" },
],
};
-102
View File
@@ -1,102 +0,0 @@
/**
* OpenAPI route module — hydration daily-goal surface (v1.25).
*
* `GET /api/hydration` reads today's summed water intake vs the user's goal;
* `PATCH /api/hydration` sets the per-user daily goal. Logging rides the
* measurements create path (POST /api/measurements, type WATER_INTAKE), so it
* is documented there, not here.
*
* Part of the OpenAPI route table; aggregated in `./index.ts`.
*/
import { z } from "zod/v4";
import type { ZodOpenApiObject } from "zod-openapi";
import { dataEnvelope, stdResponses } from "./shared";
const hydrationEntry = z.object({
id: z.string(),
value: z.number().describe("Logged amount in millilitres."),
measuredAt: z.string().describe("ISO-8601 instant the entry was logged."),
});
const hydrationTodayResponse = z
.object({
date: z.string().describe("ISO-8601 start of the user's local day."),
totalMl: z.number().describe("Today's summed intake in ml."),
goalMl: z.number().describe("Effective daily goal in ml."),
percent: z.number().describe("Progress toward the goal, capped at 100."),
rawPercent: z.number().describe("Uncapped progress; can exceed 100."),
met: z.boolean().describe("Whether the day's total reached the goal."),
remainingMl: z.number().describe("Remaining ml to the goal (0 once met)."),
entries: z.array(hydrationEntry),
})
.meta({
id: "HydrationToday",
description: "Today's water-intake total vs the user's daily goal.",
});
const hydrationGoalRequest = z
.object({
goalMl: z
.number()
.int()
.min(250)
.max(8000)
.describe("Daily hydration goal in millilitres."),
})
.meta({
id: "HydrationGoalRequest",
description: "Set the per-user daily hydration goal (ml).",
});
const hydrationGoalResponse = z
.object({ goalMl: z.number() })
.meta({ id: "HydrationGoalResponse" });
export const hydrationPaths: NonNullable<ZodOpenApiObject["paths"]> = {
"/api/hydration": {
get: {
tags: ["Hydration"],
summary: "Today's hydration total vs goal",
description:
"Sums the calling user's WATER_INTAKE measurements for the current local day and compares them against the per-user goal (default 2000 ml).",
responses: {
"200": {
description: "Today's hydration summary.",
content: {
"application/json": {
schema: dataEnvelope(
hydrationTodayResponse,
"HydrationTodayEnvelope",
),
},
},
},
...stdResponses,
},
},
patch: {
tags: ["Hydration"],
summary: "Set the daily hydration goal",
description: "Updates the per-user daily hydration goal in millilitres.",
requestBody: {
required: true,
content: { "application/json": { schema: hydrationGoalRequest } },
},
responses: {
"200": {
description: "Goal updated.",
content: {
"application/json": {
schema: dataEnvelope(
hydrationGoalResponse,
"HydrationGoalEnvelope",
),
},
},
},
...stdResponses,
},
},
},
};
-2
View File
@@ -36,7 +36,6 @@ import { biomarkerPaths } from "./biomarkers";
import { devicePaths } from "./devices";
import { exportPaths } from "./export";
import { healthRecordPaths } from "./health-record";
import { hydrationPaths } from "./hydration";
import { illnessPaths } from "./illness";
import { importPaths } from "./import";
import { insightsPaths } from "./insights";
@@ -85,7 +84,6 @@ export const openApiPaths: NonNullable<ZodOpenApiObject["paths"]> = {
...biomarkerPaths,
...illnessPaths,
...onboardingPaths,
...hydrationPaths,
};
export const openApiComponents: NonNullable<ZodOpenApiObject["components"]> = {