mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-13 14:32:03 +00:00
feat: lay down the day view and timeline contract
Land every file the day view, the timeline and life events share before any of them is built, so the server, the day view and the timeline can be built side by side without editing the same file (#613). Schema and migration 0387: LifeEvent with a short category list, calendar start and end dates, a day/month/year precision, encrypted title and note, a soft-delete tombstone and an index for the per-user live list. Every new column is annotated for the column-reader sweep. Life events travel in both backup purposes with their two ends in one file, are wiped with the account, and are registered for key rotation. src/lib/day/contract.ts carries the constants and wire types for GET /api/day/{date}, /api/day/index, /api/timeline, /api/timeline/readiness and the life-event routes, free of Zod so the navigation chrome can import it; the schemas beside it feed the routes and the published contract. The Coach and MCP tool name get_day is reserved there, and life events are listed as the one section no model ever sees. The opt-in timeline module, its navigation entry, the day-section and timeline-lane surfaces, the day and timeline query keys (evicted by every record data bundle), and stub routes that answer 501 behind their admissions. The four cross-section reads declare the whole record for now; the life-event list is a profile read, and life events join the profile sharing domain and its consent copy in all seven locales. The day, timeline and lifeEvents message namespaces carry their base copy as release-pending keys. The aggregate bundle cap moves to 4400: the branch already measured 4365 against 4335, and the new copy adds 10 KB.
This commit is contained in:
1 parent
861ba21086
commit
c79fc6cc7b
57 files changed
+4290
-21
No files matched your search
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Query keys — the day view (v1.42, #613): one local day, and the index of
|
||||
* days that hold anything over a window.
|
||||
* Part of the centralized factory; aggregated in `./index.ts`.
|
||||
*
|
||||
* Everything sits under the `["day"]` root so a write to any record table can
|
||||
* evict every open day at once: the record data bundles in `./index.ts` carry
|
||||
* the root, and a day is cheap enough to re-read that finer keys would only
|
||||
* add ways to miss one.
|
||||
*/
|
||||
export const dayKeys = {
|
||||
/** Root prefix; the data-dependent bundles invalidate through it. */
|
||||
dayRoot: () => ["day"] as const,
|
||||
/** `GET /api/day/{date}`. */
|
||||
day: (date: string) => ["day", "detail", date] as const,
|
||||
/** `GET /api/day/index`: the window bounds are the key. */
|
||||
dayIndex: (from: string, to: string) => ["day", "index", from, to] as const,
|
||||
};
|
||||
@@ -24,6 +24,7 @@ import { customMetrics } from "./custom-metrics";
|
||||
import { cycleKeys } from "./cycle";
|
||||
import { dailyKeys } from "./daily";
|
||||
import { dashboardKeys } from "./dashboard";
|
||||
import { dayKeys } from "./day";
|
||||
import { environmentKeys } from "./environment";
|
||||
import { documentKeys } from "./documents";
|
||||
import { encounterKeys } from "./encounters";
|
||||
@@ -41,6 +42,7 @@ import { onboardingKeys } from "./onboarding";
|
||||
import { recordSettingsKeys } from "./record-settings";
|
||||
import { profileKeys } from "./profile";
|
||||
import { settingsKeys } from "./settings";
|
||||
import { timelineKeys } from "./timeline";
|
||||
import { sharingKeys } from "./sharing";
|
||||
import { vaccinationKeys } from "./vaccinations";
|
||||
import { workoutKeys } from "./workouts";
|
||||
@@ -76,6 +78,8 @@ export const queryKeys = {
|
||||
...sharingKeys,
|
||||
...vaccinationKeys,
|
||||
...aiRunKeys,
|
||||
...dayKeys,
|
||||
...timelineKeys,
|
||||
};
|
||||
|
||||
export { recordSettingsKeys } from "./record-settings";
|
||||
@@ -151,6 +155,10 @@ export const measurementDependentKeys = [
|
||||
["sleep-night"] as const,
|
||||
// v1.17.0 — refresh the sleep-debt + chronotype read when sleep rows change.
|
||||
["sleep-rhythm"] as const,
|
||||
// v1.42 — an open day and the timeline read every record table, so a
|
||||
// write to this one evicts both roots.
|
||||
queryKeys.dayRoot(),
|
||||
queryKeys.timelineRoot(),
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -181,6 +189,10 @@ export const moodDependentKeys = [
|
||||
// server-side. Call sites force an inactive refetch too (see
|
||||
// `refetchInactiveDailyReads`).
|
||||
queryKeys.dailyDigest(),
|
||||
// v1.42 — an open day and the timeline read every record table, so a
|
||||
// write to this one evicts both roots.
|
||||
queryKeys.dayRoot(),
|
||||
queryKeys.timelineRoot(),
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -232,6 +244,10 @@ export const medicationDependentKeys = [
|
||||
queryKeys.dailyDigest(),
|
||||
["dashboard-medication-compliance"] as const,
|
||||
["compliance-chart-inline"] as const,
|
||||
// v1.42 — an open day and the timeline read every record table, so a
|
||||
// write to this one evicts both roots.
|
||||
queryKeys.dayRoot(),
|
||||
queryKeys.timelineRoot(),
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -242,7 +258,14 @@ export const medicationDependentKeys = [
|
||||
* log. `insightsRoot()` rides along because phase-correlation cards depend
|
||||
* on the same rows.
|
||||
*/
|
||||
export const cycleDependentKeys = [queryKeys.cycle(), queryKeys.insightsRoot()];
|
||||
export const cycleDependentKeys = [
|
||||
queryKeys.cycle(),
|
||||
queryKeys.insightsRoot(),
|
||||
// v1.42 — an open day and the timeline read every record table, so a
|
||||
// write to this one evicts both roots.
|
||||
queryKeys.dayRoot(),
|
||||
queryKeys.timelineRoot(),
|
||||
];
|
||||
|
||||
/**
|
||||
* Keys invalidated when an illness episode starts, ends, is edited, deleted,
|
||||
@@ -261,6 +284,10 @@ export const illnessDependentKeys = [
|
||||
// v1.39.2 — a condition's body site is half of the body-site view and of
|
||||
// the suggestions a body-site field offers.
|
||||
queryKeys.bodySitesAll(),
|
||||
// v1.42 — an open day and the timeline read every record table, so a
|
||||
// write to this one evicts both roots.
|
||||
queryKeys.dayRoot(),
|
||||
queryKeys.timelineRoot(),
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -290,6 +317,10 @@ export const encounterDependentKeys = [
|
||||
// seeds its replace-set visit picker from its own cached links: left
|
||||
// stale, the next tap there would delete the link just made.
|
||||
queryKeys.documents(),
|
||||
// v1.42 — an open day and the timeline read every record table, so a
|
||||
// write to this one evicts both roots.
|
||||
queryKeys.dayRoot(),
|
||||
queryKeys.timelineRoot(),
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -313,6 +344,10 @@ export const vaccinationDependentKeys = [
|
||||
// seeds its replace-set dose picker from its own cached links: left stale,
|
||||
// the next tap there would delete the link just made.
|
||||
queryKeys.documents(),
|
||||
// v1.42 — an open day and the timeline read every record table, so a
|
||||
// write to this one evicts both roots.
|
||||
queryKeys.dayRoot(),
|
||||
queryKeys.timelineRoot(),
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Query keys — the life timeline and life events (v1.42, #613).
|
||||
* Part of the centralized factory; aggregated in `./index.ts`.
|
||||
*
|
||||
* The timeline, its readiness inventory and the life-event list share the
|
||||
* `["timeline"]` root: a life-event write changes all three, and a write to any
|
||||
* other record table evicts the root through the data bundles in `./index.ts`.
|
||||
*/
|
||||
export const timelineKeys = {
|
||||
/** Root prefix; the data-dependent bundles invalidate through it. */
|
||||
timelineRoot: () => ["timeline"] as const,
|
||||
/**
|
||||
* `GET /api/timeline`. Zoom, window and the chosen value series are the
|
||||
* key: each combination is a different payload.
|
||||
*/
|
||||
timeline: (
|
||||
zoom: string,
|
||||
from: string | null,
|
||||
to: string | null,
|
||||
values: string,
|
||||
) => ["timeline", "lanes", zoom, from, to, values] as const,
|
||||
/** `GET /api/timeline/readiness`. */
|
||||
timelineReadiness: () => ["timeline", "readiness"] as const,
|
||||
/** `GET /api/life-events`. */
|
||||
lifeEvents: () => ["timeline", "life-events"] as const,
|
||||
};
|
||||
Reference in new issue
Block a user