Files
fquiz/api/app/schemas
chengkai3 3fb4d5f170 fix:[FL-172][高程数据管理页面上传文件提交表单报错]
修复高程文件上传接口的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>
2026-06-21 13:15:29 +08:00
..
2026-06-20 23:20:26 +08:00
2026-04-24 15:50:52 +08:00
2026-04-26 09:00:49 +08:00
2026-04-12 16:00:20 +08:00