--- description: NestJS 模块依赖与 Prisma 写权限 — 后端 OWNER 边界 globs: server/dukang-api/src/**/*.ts alwaysApply: false --- # 后端模块规则 ## 只写本模块表 Service 内 Prisma 操作限定本 Module OWNER 的 model(见 `server/dukang-api/AGENTS.md`)。 ## 禁止依赖(示例) ```typescript // ❌ redeem.service.ts await this.prisma.order.update(...) // ✅ redeem.service.ts await this.benefitService.deduct(dto) await this.settlementService.createStorePayout(recordId) ``` ```typescript // ❌ benefit.module.ts imports TradeModule // ❌ store.service.ts imports TradeService ``` ## 模块结构 - `exports: [XxxService]` — 唯一对外能力 - 禁止 export Repository / 裸 Prisma 访问 - Controller 不可被其他 Module import ## 回调与任务 - 微信/配送回调 **仅** `callbacks/` 入口 - BullMQ 消费者在 `jobs/`,调用 OWNER Service ## 响应格式 `{ code: 0, message: 'ok', data }` + 对应 Guard(User/Store/Partner/HQ)