Files
Neo-ZQYY/.cursor/rules/backend-fastapi.mdc
2026-05-02 03:11:39 +08:00

15 lines
671 B
Plaintext
Raw 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.
---
description: FastAPI 后端规则响应包装、认证、AI 集成、RLS 与测试库。
globs: apps/backend/**
alwaysApply: false
---
# 后端规则
- 2xx 响应经 `ResponseWrapperMiddleware` 包装为 `{ "code": 0, "data": <payload> }`。
- 后端内部使用 snake_caseJSON 输出通过 `CamelModel` 转 camelCase。
- admin、miniapp、tenant-admin 三类 JWT aud 不可混用。
- 访问 ETL FDW/RLS 视图前必须设置 `app.current_site_id`。
- AI 集成涉及 DashScope、熔断、限流、预算、缓存和运行日志改动后必须查审计历史。
- 后端验证默认在 `apps/backend` 下运行,使用测试库,禁止连正式库。