mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 21:32:18 +00:00
The tile-layout enum migrates from German to English to match the route slugs. The contract on `GET/PUT /api/insights/layout` stays non-breaking for clients that persisted the old German ids (the iOS layout sync among them): - the Zod enum is built from `ACCEPTED_INSIGHTS_TILE_IDS` (canonical English plus the legacy German aliases), so a PUT carrying old ids validates rather than tripping a 422; - `normalizeInsightsTileId` collapses each legacy id onto its canonical English replacement on both the read path (`resolveInsightsLayout`) and the write path (`serializeInsightsLayout`), so a pre-rename layout surfaces English ids on GET without a forced re-PUT and a legacy PUT persists English ids; - a layout carrying both a legacy and a canonical id for one tile dedupes to a single canonical entry. The legacy ids are accepted-but-deprecated. Tests cover the read-side normalisation and the write-side 200 (no 422) + canonical persistence.