feat(tools): 数据库查询按权限拆分为 user/admin,强制 userId 隔离
- query/ 为内部实现,user/ 仅供 bot-escort(绑定登录用户、schema 不暴露 userId),admin/ 仅供 escort-admin(显式跨用户) - 新增 employee、employee_review 查询;health_profile 用户端补齐 userId 隔离,按 _id 精确查询也带归属条件 - organization 是公共数据且无 userId,不进用户端;机构与写入工具统一移入 admin/ - utils 增加严格 ObjectId 解析,避免 CastError 与畸形 ID 进入查询 - 用户端员工视图剔除手机号、证件号、证书编号、紧急联系人与内部备注 - 新增 test/db_tools.test.js,用模型桩断言查询条件确实带 userId
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import { buildEmployeeReviewQueryTool } from "../query/employee_review_query.js";
|
||||
|
||||
/**
|
||||
* 用户端员工评价查询工具
|
||||
*
|
||||
* 只传入当前登录用户的 userId,schema 不暴露 userId 参数;
|
||||
* 查询强制按评价人 userId 隔离,只返回本人提交的评价。
|
||||
*/
|
||||
const createEmployeeReviewQueryTool = (userInfo) =>
|
||||
buildEmployeeReviewQueryTool({ userId: userInfo?._id });
|
||||
|
||||
export { createEmployeeReviewQueryTool };
|
||||
Reference in New Issue
Block a user