mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 13:01:00 +00:00
refactor(import): derive the CSV example header from the shared column list
The downloadable CSV example pinned its header as an inline string literal while csv-measurements.ts exported CSV_EXAMPLE_COLUMNS as the documented single source of truth for that order — so the two could silently drift. Derive the example header from the constant; the column order now has one owner and the previously unused export is wired in.
This commit is contained in:
1 parent
a27247f93c
commit
7a96a934bf
1 file changed
+2
-1
@@ -45,6 +45,7 @@ import { queryKeys } from "@/lib/query-keys";
|
||||
import { useTranslations } from "@/lib/i18n/context";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { apiFetchRaw, apiGet } from "@/lib/api/api-fetch";
|
||||
import { CSV_EXAMPLE_COLUMNS } from "@/lib/import/csv-measurements";
|
||||
|
||||
// ─────────────────────────── Section wrapper ───────────────────────────
|
||||
|
||||
@@ -641,7 +642,7 @@ function JsonImportCard() {
|
||||
* drift. Exported so a test can assert it stays a valid header.
|
||||
*/
|
||||
export const EXAMPLE_CSV = [
|
||||
"type,value,unit,measuredAt,glucoseContext,notes,externalId",
|
||||
CSV_EXAMPLE_COLUMNS.join(","),
|
||||
"WEIGHT,80.5,kg,2026-05-01T08:00:00Z,,morning,",
|
||||
"BLOOD_GLUCOSE,5.3,mmol/L,2026-05-01T08:05:00+02:00,FASTING,,meter-001",
|
||||
"BLOOD_PRESSURE_SYS,120,mmHg,2026-05-01T08:05:00+02:00,,,",
|
||||
|
||||
Reference in new issue
Block a user