家庭动态:老人/家属发言、三种可见范围,家庭内部内容不会播给老人。 共同照护:家庭备忘录、任务创建、认领、完成与交接记录。 用药闭环:计划、未来 7 天提醒实例、确认服用、延后、异常反馈。 风险闭环:红橙黄蓝分级、30 分钟去重、推送、认领、处理与误报记录。 报平安:家属发起、老人语音回应、状态同步。 Web 导航升级为守护、家庭、照护、陪伴、我的。 设备接口已升级为设备令牌认证,UUID 不再单独承担认证。
14 lines
658 B
TypeScript
14 lines
658 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { createFamilyPost } from "@/lib/family-guard";
|
|
import { getCaregiverSession } from "@/lib/session";
|
|
|
|
export async function POST(request: Request) {
|
|
try {
|
|
const caregiver = await getCaregiverSession();
|
|
if (!caregiver) return NextResponse.json({ error: "请先登录。" }, { status: 401 });
|
|
const body = await request.json().catch(() => ({}));
|
|
const post = await createFamilyPost(caregiver.id, body);
|
|
return NextResponse.json({ ok: true, post });
|
|
} catch (error) { return NextResponse.json({ error: error instanceof Error ? error.message : "发布失败。" }, { status: 400 }); }
|
|
}
|