覆盖所有模块: - api 层:17 个路由文件,每个接口标注用途、参数、返回值、权限 - services 层:18 个服务文件,每个方法标注作用、参数、返回值、调用方 - repositories 层:13 个仓储文件,每个方法标注查询逻辑和被调用方 - schemas 层:11 个请求/响应体文件,每个字段标注业务含义 - core 层:config、security、exceptions、responses、error_codes - models 层:19 个 ORM 模型类,每个表标注业务含义和关联关系 - scripts:bootstrap_data、smoke_check - migrations:env.py 和版本迁移文件 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
30 lines
668 B
Python
30 lines
668 B
Python
"""
|
||
API 基础路由模块
|
||
|
||
职责:
|
||
提供系统级别的基础接口(如健康检查),URL 无公共前缀。
|
||
当前仅包含 /health 接口。
|
||
"""
|
||
from fastapi import APIRouter
|
||
|
||
from backend.app.core.responses import success_response
|
||
|
||
router = APIRouter()
|
||
|
||
|
||
@router.get("/health")
|
||
def health() -> dict:
|
||
"""健康检查接口
|
||
|
||
用途:供运维或负载均衡探活,验证服务是否正常运行。
|
||
请求参数:无。
|
||
返回值:{"status": "ok", "service": "backend"}
|
||
权限要求:无需认证。
|
||
"""
|
||
return success_response(
|
||
{
|
||
"status": "ok",
|
||
"service": "backend",
|
||
}
|
||
)
|