chore(format): prettier sweep across develop

Mostly table column normalisation under docs/audit/ + planning, object-
literal expansion in src/lib/ai/coach/snapshot.ts after the W4 F6 Apple
Health metric block landed, and small wrap/unwrap line adjustments in
the device + APNs routes / tests touched across W3/W4/W5 sessions.
No behavioural change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marc-André BombeckandClaude Opus 4.7 committed 2026-05-11 08:27:51 +02:00
1 parent 5dcd3954a0
commit f1e6630958
70 files changed
+899 -660

No files matched your search

@@ -60,15 +60,21 @@ function req(): NextRequest {
beforeEach(() => {
vi.resetAllMocks();
vi.mocked(prisma.refreshToken.findMany).mockResolvedValue([]);
vi.mocked(prisma.refreshToken.updateMany).mockResolvedValue({ count: 0 } as never);
vi.mocked(prisma.apiToken.updateMany).mockResolvedValue({ count: 0 } as never);
vi.mocked(prisma.refreshToken.updateMany).mockResolvedValue({
count: 0,
} as never);
vi.mocked(prisma.apiToken.updateMany).mockResolvedValue({
count: 0,
} as never);
vi.mocked(prisma.$transaction).mockResolvedValue([] as never);
});
describe("DELETE /api/devices/[id] (iOS token-rotation endpoint)", () => {
it("returns 401 when unauthenticated", async () => {
vi.mocked(getSession).mockResolvedValue(null);
const res = await DELETE(req(), { params: Promise.resolve({ id: "dev-1" }) });
const res = await DELETE(req(), {
params: Promise.resolve({ id: "dev-1" }),
});
expect(res.status).toBe(401);
});
@@ -80,7 +86,9 @@ describe("DELETE /api/devices/[id] (iOS token-rotation endpoint)", () => {
model: "iPhone",
bundleId: "io.healthlog.app",
} as never);
const res = await DELETE(req(), { params: Promise.resolve({ id: "dev-x" }) });
const res = await DELETE(req(), {
params: Promise.resolve({ id: "dev-x" }),
});
expect(res.status).toBe(404);
});
@@ -97,7 +105,9 @@ describe("DELETE /api/devices/[id] (iOS token-rotation endpoint)", () => {
] as never);
vi.mocked(prisma.device.delete).mockResolvedValue({ id: "dev-1" } as never);
const res = await DELETE(req(), { params: Promise.resolve({ id: "dev-1" }) });
const res = await DELETE(req(), {
params: Promise.resolve({ id: "dev-1" }),
});
expect(res.status).toBe(200);
expect(vi.mocked(prisma.device.delete)).toHaveBeenCalled();
});
+5 -1
View File
@@ -46,7 +46,11 @@ export const DELETE = apiHandler(
},
});
annotate({
action: { name: "devices.revoke", entity_type: "device", entity_id: result.id },
action: {
name: "devices.revoke",
entity_type: "device",
entity_id: result.id,
},
meta: {
refresh_tokens_revoked: result.refreshTokensRevoked,
access_tokens_revoked: result.accessTokensRevoked,
+1 -4
View File
@@ -114,10 +114,7 @@ export const POST = apiHandler(async (request: NextRequest) => {
deviceId: existingApns.id,
},
});
return apiError(
"APNs token already registered to another account",
409,
);
return apiError("APNs token already registered to another account", 409);
}
}