From a0dffbdaeb1c55b0bc64b98d1fccc6ea8621333b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Thu, 14 May 2026 12:12:59 +0200 Subject: [PATCH] style: prettier on v1.4.25 W7 timezone files --- docs/api/openapi.yaml | 30 ++++++++++++++------- src/app/api/auth/me/timezone/route.ts | 7 ++++- src/lib/__tests__/export.test.ts | 5 +++- src/lib/tz/resolver.ts | 5 +++- tests/integration/timezone-per-user.test.ts | 13 +++++---- 5 files changed, 40 insertions(+), 20 deletions(-) diff --git a/docs/api/openapi.yaml b/docs/api/openapi.yaml index b29f4eab2..3504921f1 100644 --- a/docs/api/openapi.yaml +++ b/docs/api/openapi.yaml @@ -210,7 +210,8 @@ components: - error type: object DeviceRegisterRequest: - description: Native device registration. Re-registering an APNs token belonging to another user returns 409 + description: + Native device registration. Re-registering an APNs token belonging to another user returns 409 (cross-user-hijack guard). properties: apnsEnvironment: @@ -353,7 +354,8 @@ components: type: object InsightsComprehensiveResponse: additionalProperties: false - description: AI-generated insights bundle. Strict-schema validated server-side; Coach-routed when the insight surface + description: + AI-generated insights bundle. Strict-schema validated server-side; Coach-routed when the insight surface needs day-level grounding. properties: citations: @@ -718,7 +720,8 @@ openapi: 3.1.0 paths: /api/auth/login: post: - description: "Browser callers receive a session cookie. Native callers (X-Client-Type: native or HealthLog-iOS UA + description: + "Browser callers receive a session cookie. Native callers (X-Client-Type: native or HealthLog-iOS UA prefix) additionally receive a paired access + refresh token." requestBody: content: @@ -766,7 +769,8 @@ paths: - Auth /api/auth/me/coach-prefs: get: - description: Returns the persisted preferences with defaults filled in. Null persisted state resolves to the legacy + description: + Returns the persisted preferences with defaults filled in. Null persisted state resolves to the legacy v1.4.22 defaults. responses: "200": @@ -782,7 +786,8 @@ paths: tags: - Auth put: - description: Persists the supplied prefs. Body is validated against `CoachPrefs`; missing keys fall back to the + description: + Persists the supplied prefs. Body is validated against `CoachPrefs`; missing keys fall back to the documented defaults. requestBody: content: @@ -860,7 +865,8 @@ paths: - Auth /api/auth/refresh: post: - description: Reuse of a consumed refresh token revokes every refresh token still active for the originating device + description: + Reuse of a consumed refresh token revokes every refresh token still active for the originating device (per-device blast radius from v1.4.23). Legacy tokens issued before v1.4.23 with a null deviceId fall back to revoke-all-for-user. requestBody: @@ -884,7 +890,8 @@ paths: - Auth /api/devices: post: - description: Idempotent upsert by `token`. APNs token + environment are paired — supplying one without the other returns + description: + Idempotent upsert by `token`. APNs token + environment are paired — supplying one without the other returns 422. Cross-user re-registration of either identifier returns 409. requestBody: content: @@ -913,7 +920,8 @@ paths: - Devices /api/insights/chat/messages/{id}/feedback: post: - description: Persists a helpful/unhelpful rating for a single Coach reply. Reuses the v1.4.16 RecommendationFeedback + description: + Persists a helpful/unhelpful rating for a single Coach reply. Reuses the v1.4.16 RecommendationFeedback table via the polymorphic `targetType` column. The aggregator buckets ratings by (promptVersion, tone, verbosity). requestBody: @@ -949,7 +957,8 @@ paths: - Insights /api/insights/comprehensive: get: - description: Full Insights surface — daily briefing, recommendations with rationale, optional weekly report + storyboard + description: + Full Insights surface — daily briefing, recommendations with rationale, optional weekly report + storyboard annotations. Strict-schema validated server-side. responses: "200": @@ -1121,7 +1130,8 @@ paths: - Measurements /api/measurements/batch: post: - description: Up to 500 HealthKit entries per call. Idempotent via the `Idempotency-Key` header (replay window 24h). + description: + Up to 500 HealthKit entries per call. Idempotent via the `Idempotency-Key` header (replay window 24h). Per-entry status lets the iOS client advance its sync cursor accurately. requestBody: content: diff --git a/src/app/api/auth/me/timezone/route.ts b/src/app/api/auth/me/timezone/route.ts index 596458dd2..e5b849fcb 100644 --- a/src/app/api/auth/me/timezone/route.ts +++ b/src/app/api/auth/me/timezone/route.ts @@ -20,7 +20,12 @@ import { NextRequest } from "next/server"; import { prisma } from "@/lib/db"; import { apiHandler, requireAuth } from "@/lib/api-handler"; -import { apiError, apiSuccess, getClientIp, safeJson } from "@/lib/api-response"; +import { + apiError, + apiSuccess, + getClientIp, + safeJson, +} from "@/lib/api-response"; import { annotate } from "@/lib/logging/context"; import { auditLog } from "@/lib/auth/audit"; import { invalidateUserTimezone, isValidTimezone } from "@/lib/tz/resolver"; diff --git a/src/lib/__tests__/export.test.ts b/src/lib/__tests__/export.test.ts index e530b5506..cc006fcfc 100644 --- a/src/lib/__tests__/export.test.ts +++ b/src/lib/__tests__/export.test.ts @@ -122,7 +122,10 @@ describe("formatMeasurementsForExport", () => { notes: null, }, ]; - const result = formatMeasurementsForExport(measurements, "Pacific/Auckland"); + const result = formatMeasurementsForExport( + measurements, + "Pacific/Auckland", + ); expect(result[0].measuredAt).toBe("2026-05-15T21:00:00+12:00"); }); diff --git a/src/lib/tz/resolver.ts b/src/lib/tz/resolver.ts index 8c7810d35..b8def446a 100644 --- a/src/lib/tz/resolver.ts +++ b/src/lib/tz/resolver.ts @@ -111,7 +111,10 @@ export async function resolveServerDefaultTimezone(): Promise { where: { id: "singleton" }, select: { defaultUserTimezone: true }, }); - if (settings?.defaultUserTimezone && isValidTimezone(settings.defaultUserTimezone)) { + if ( + settings?.defaultUserTimezone && + isValidTimezone(settings.defaultUserTimezone) + ) { tz = settings.defaultUserTimezone; } } catch { diff --git a/tests/integration/timezone-per-user.test.ts b/tests/integration/timezone-per-user.test.ts index 78baa9945..184049963 100644 --- a/tests/integration/timezone-per-user.test.ts +++ b/tests/integration/timezone-per-user.test.ts @@ -112,7 +112,9 @@ describe("per-user timezone — Pacific/Auckland end-to-end", () => { const body = await res.text(); // Header row + one data row. - expect(body).toContain("type,value,unit,measuredAt,source,notes,glucoseContext"); + expect(body).toContain( + "type,value,unit,measuredAt,source,notes,glucoseContext", + ); // The Auckland offset in May = +12:00 (NZST). The CSV row // should carry it verbatim, never the bare Z. expect(body).toContain("2026-05-16T00:00:00+12:00"); @@ -197,9 +199,7 @@ describe("per-user timezone — Pacific/Auckland end-to-end", () => { it("CSV export with no userTz (legacy callers) emits the Z suffix", async () => { // This protects the canonical-backup-on-disk contract — the // export library has a backward-compatible no-userTz path. - const { formatMeasurementsForExport, toCSV } = await import( - "@/lib/export" - ); + const { formatMeasurementsForExport, toCSV } = await import("@/lib/export"); const csv = toCSV( formatMeasurementsForExport([ { @@ -253,9 +253,8 @@ describe("per-user timezone — Pacific/Auckland end-to-end", () => { // the unset-default path here. const prisma = getPrismaClient(); // Make sure no leftover row pins a default. - const { invalidateServerDefaultTimezone } = await import( - "@/lib/tz/resolver" - ); + const { invalidateServerDefaultTimezone } = + await import("@/lib/tz/resolver"); invalidateServerDefaultTimezone(); const { POST } = await import("@/app/api/auth/register/route");