mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
style: prettier on v1.4.25 W7 timezone files
This commit is contained in:
1 parent
78186ba549
commit
a0dffbdaeb
5 files changed
+40
-20
No files matched your search
+20
-10
@@ -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:
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
|
||||
|
||||
@@ -111,7 +111,10 @@ export async function resolveServerDefaultTimezone(): Promise<string> {
|
||||
where: { id: "singleton" },
|
||||
select: { defaultUserTimezone: true },
|
||||
});
|
||||
if (settings?.defaultUserTimezone && isValidTimezone(settings.defaultUserTimezone)) {
|
||||
if (
|
||||
settings?.defaultUserTimezone &&
|
||||
isValidTimezone(settings.defaultUserTimezone)
|
||||
) {
|
||||
tz = settings.defaultUserTimezone;
|
||||
}
|
||||
} catch {
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in new issue
Block a user