Merge commit '38214e472' into work/v137-record-session-fence

This commit is contained in:
Marc-André Bombeck committed 2026-08-06 17:10:56 +02:00
commit a08e82d0be
81 files changed
+3505 -386

No files matched your search

+2 -2
View File
@@ -16,7 +16,7 @@
import { NextRequest } from "next/server";
import { prisma } from "@/lib/db";
import { apiHandler, requireAuth } from "@/lib/api-handler";
import { apiHandler, requireRecordAuth } from "@/lib/api-handler";
import { annotate } from "@/lib/logging/context";
import { apiError, apiSuccess } from "@/lib/api-response";
import { requireCycleEnabled } from "@/lib/cycle/gate";
@@ -43,7 +43,7 @@ const DEFAULT_FORWARD_DAYS = 180;
const MAX_SPAN_DAYS = 400;
export const GET = apiHandler(async (request: NextRequest) => {
const { user } = await requireAuth();
const { user } = await requireRecordAuth("read", "cycle");
const gate = await requireCycleEnabled(user.id, user.gender);
if (!gate.enabled) return gate.response;
+2 -2
View File
@@ -15,7 +15,7 @@
* is causal.
*/
import { prisma } from "@/lib/db";
import { apiHandler, requireAuth } from "@/lib/api-handler";
import { apiHandler, requireRecordAuth } from "@/lib/api-handler";
import { annotate } from "@/lib/logging/context";
import { apiSuccess, apiError } from "@/lib/api-response";
import { requireCycleEnabled } from "@/lib/cycle/gate";
@@ -50,7 +50,7 @@ const WINDOW_DAYS = 365;
export const dynamic = "force-dynamic";
export const GET = apiHandler(async () => {
const { user } = await requireAuth();
const { user } = await requireRecordAuth("read", "cycle");
const gate = await requireCycleEnabled(user.id, user.gender);
if (!gate.enabled) return gate.response;
+26
View File
@@ -0,0 +1,26 @@
import { apiHandler, requireRecordAuth } from "@/lib/api-handler";
import { apiSuccess } from "@/lib/api-response";
import { annotate } from "@/lib/logging/context";
import { readProfileSummary } from "@/lib/records/profile-summary";
export const dynamic = "force-dynamic";
/**
* Read-only shared-record profile summary. The underlying fields are bounded
* and structured so this endpoint never becomes a Settings or AI surface.
*/
export const GET = apiHandler(async () => {
const { user } = await requireRecordAuth("read", "profile");
const summary = await readProfileSummary(user.id);
annotate({
action: { name: "profile.summary.get" },
meta: {
allergy_count: summary.allergies.length,
family_history_count: summary.familyHistory.length,
fact_count: summary.facts.length,
},
});
return apiSuccess(summary);
});