fix: tighten real operations data paths

This commit is contained in:
2026-07-02 19:16:29 -07:00
parent 8b2fb0930e
commit 5fe7e5a1b8
8 changed files with 286 additions and 117 deletions

View File

@@ -64,18 +64,9 @@ export async function PATCH(request: Request, context: RouteContext): Promise<Re
throw new Error("申请已处理");
}
let roleId = readString(body, "roleId");
const roleId = readString(body, "roleId");
if (decision === "approved" && !roleId) {
const defaultRoleRows = await transaction
.select()
.from(roles)
.where(and(eq(roles.organizationId, joinRequest.organizationId), eq(roles.key, "caregiver")))
.limit(1);
const defaultRole = defaultRoleRows[0];
if (!defaultRole) {
throw new Error("默认角色不存在");
}
roleId = defaultRole.id;
throw new Error("请选择审批角色");
}
if (decision === "approved") {