Files
lik f3a1ef89bc 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
2026-11-01 11:42:27 +08:00

13 lines
412 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { buildEmployeeQueryTool } from "../query/employee_query.js";
/**
* 用户端员工查询工具
*
* 只传入当前登录用户的 userId,schema 不暴露 userId 参数;
* 查询强制按 userId 隔离,并只输出本人员工档案的非敏感字段。
*/
const createEmployeeQueryTool = (userInfo) =>
buildEmployeeQueryTool({ userId: userInfo?._id });
export { createEmployeeQueryTool };