3fb4d5f170
修复高程文件上传接口的422错误。 问题原因: ElevationFileRecordCreateRequest schema 的 mount_code 字段设置了 min_length=2 约束, 当前端传递空字符串时,Pydantic 验证失败导致 422 Unprocessable Entity 错误。 解决方案: 1. 添加 field_validator,将空字符串转换为 None 2. 应用到以下 Request schemas 的可选字符串字段: - ElevationFileRecordCreateRequest: source, mount_code, notes - ElevationFileRecordUpdateRequest: source, notes - ElevationDatasetCreateRequest: source, mount_code, file_name, notes - ElevationDatasetUpdateRequest: name, source, notes 这样可以确保: - 空字符串被规范化为 None - 保持向后兼容性 - 后端逻辑可以正确使用默认 mount_code(第一个可用挂载点) Co-authored-by: multica-agent <github@multica.ai>
API Service
FastAPI 后端服务,包含用户认证和 RBAC 权限控制。
核心能力
- JWT Access Token(默认 8 小时)
- Refresh Session(HttpOnly Cookie,默认 30 天,刷新轮换)
- RBAC(用户-角色-权限)
- 用户管理接口(需
user.manage)
本地开发
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r api/requirements.txt
python -m uvicorn api.app.main:app --reload --host 0.0.0.0 --port 8000
主要接口
GET /healthGET /api/v1/pingPOST /api/v1/auth/registerPOST /api/v1/auth/loginPOST /api/v1/auth/refreshPOST /api/v1/auth/logoutGET /api/v1/auth/meGET /api/v1/users