feat(交易记录): 新增交易记录管理页面与API接口 feat(上传): 添加统一上传接口支持自动识别文件类型 feat(用户管理): 为用户模型添加备注字段并更新相关接口 feat(邮件): 实现SMTP邮件发送功能并添加测试脚本 feat(短信): 增强短信服务配置灵活性与日志记录 fix(发票): 修复发票列表时间筛选功能 fix(nginx): 调整上传大小限制与超时配置 docs: 添加多个功能模块的说明文档 docs(估值): 补充估值计算流程与API提交数据说明 chore: 更新依赖与Docker镜像版本
22 lines
930 B
Python
22 lines
930 B
Python
from fastapi import APIRouter, UploadFile, File
|
|
from app.controllers.upload import UploadController
|
|
from app.schemas.upload import ImageUploadResponse, FileUploadResponse
|
|
|
|
router = APIRouter()
|
|
|
|
@router.post("/image", response_model=ImageUploadResponse, summary="上传图片")
|
|
async def upload_image(file: UploadFile = File(...)) -> ImageUploadResponse:
|
|
"""
|
|
上传图片接口
|
|
:param file: 图片文件
|
|
:return: 图片URL和文件名
|
|
"""
|
|
return await UploadController.upload_image(file)
|
|
|
|
@router.post("/file", response_model=FileUploadResponse, summary="上传文件")
|
|
async def upload_file(file: UploadFile = File(...)) -> FileUploadResponse:
|
|
return await UploadController.upload_file(file)
|
|
|
|
@router.post("/upload", response_model=FileUploadResponse, summary="统一上传接口")
|
|
async def upload(file: UploadFile = File(...)) -> FileUploadResponse:
|
|
return await UploadController.upload_any(file) |