mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-13 06:32:03 +00:00
feat(02-12): add scoped profile summary
- expose bounded read-only profile facts for shared records\n- keep profile navigation separate from Settings mutations
This commit is contained in:
1 parent
e2d308ec31
commit
9eab70f032
7 files changed
+233
-2
No files matched your search
@@ -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);
|
||||
});
|
||||
Reference in new issue
Block a user