diff --git a/handler/car.py b/handler/car.py index 55cc03c..e3361fb 100644 --- a/handler/car.py +++ b/handler/car.py @@ -12,7 +12,7 @@ from utils.model import model_list router = APIRouter(tags=["Car"], prefix="/car") -@router.post("/list") +@router.post("/list", summary="题目列表") def get_list(dto: ListDto, db: Session = Depends(database)): (page, size, keyword) = (dto.page, dto.size, dto.keyword) order_by_wrong_rate = dto.order_by_wrong_rate diff --git a/model/car/dto/list.py b/model/car/dto/list.py index 45da552..68548fb 100644 --- a/model/car/dto/list.py +++ b/model/car/dto/list.py @@ -1,8 +1,9 @@ +from fastapi import Body from pydantic import BaseModel class ListDto(BaseModel): - page: int = 1 - size: int = 10 - keyword: str = "" - order_by_wrong_rate: bool = True + page: int = Body(description="页数", default=1) + size: int = Body(description="页面大小", default=10) + keyword: str = Body(description="查询关键字", default="") + order_by_wrong_rate: bool = Body(alias="orderByWrongRate", description="按错误率排序", default=True)