mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 13:52:20 +00:00
- expose bounded read-only profile facts for shared records\n- keep profile navigation separate from Settings mutations
27 lines
861 B
TypeScript
27 lines
861 B
TypeScript
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);
|
|
});
|