家庭动态:老人/家属发言、三种可见范围,家庭内部内容不会播给老人。 共同照护:家庭备忘录、任务创建、认领、完成与交接记录。 用药闭环:计划、未来 7 天提醒实例、确认服用、延后、异常反馈。 风险闭环:红橙黄蓝分级、30 分钟去重、推送、认领、处理与误报记录。 报平安:家属发起、老人语音回应、状态同步。 Web 导航升级为守护、家庭、照护、陪伴、我的。 设备接口已升级为设备令牌认证,UUID 不再单独承担认证。
19 lines
1.2 KiB
TypeScript
19 lines
1.2 KiB
TypeScript
import { NextResponse } from "next/server";
|
|
import { requireDeviceAuth } from "@/lib/device-auth";
|
|
import { getDeviceAgenda } from "@/lib/family-guard";
|
|
|
|
export async function GET(request: Request) {
|
|
const deviceUuid = new URL(request.url).searchParams.get("deviceUuid") || "";
|
|
try {
|
|
await requireDeviceAuth(request, deviceUuid);
|
|
const agenda = await getDeviceAgenda(deviceUuid);
|
|
return NextResponse.json({
|
|
circleName: agenda.circle?.name || null,
|
|
posts: agenda.posts.map((post) => ({ id: post.id, content: post.content, authorName: post.author?.nickname || post.author?.username || "家里人", createdAt: post.createdAt })),
|
|
memos: agenda.memos.map((memo) => ({ id: memo.id, title: memo.title, content: memo.content, priority: memo.priority })),
|
|
doses: agenda.doses.map((dose) => ({ id: dose.id, scheduledFor: dose.scheduledFor, status: dose.status, name: dose.medicationPlan.name, dosage: dose.medicationPlan.dosage, instructions: dose.medicationPlan.instructions })),
|
|
checkIns: agenda.checkIns,
|
|
});
|
|
} catch (error) { return NextResponse.json({ error: error instanceof Error ? error.message : "读取今日照护事项失败。" }, { status: 401 }); }
|
|
}
|