fix: tighten real operations data paths
This commit is contained in:
@@ -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") {
|
||||
|
||||
Reference in New Issue
Block a user