/car/list 调整为 post
This commit is contained in:
parent
44d5c2ac81
commit
2860dfb5ef
@ -12,7 +12,7 @@ from utils.model import model_list
|
|||||||
router = APIRouter(tags=["Car"], prefix="/car")
|
router = APIRouter(tags=["Car"], prefix="/car")
|
||||||
|
|
||||||
|
|
||||||
@router.post("/list")
|
@router.post("/list", summary="题目列表")
|
||||||
def get_list(dto: ListDto, db: Session = Depends(database)):
|
def get_list(dto: ListDto, db: Session = Depends(database)):
|
||||||
(page, size, keyword) = (dto.page, dto.size, dto.keyword)
|
(page, size, keyword) = (dto.page, dto.size, dto.keyword)
|
||||||
order_by_wrong_rate = dto.order_by_wrong_rate
|
order_by_wrong_rate = dto.order_by_wrong_rate
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
from fastapi import Body
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
class ListDto(BaseModel):
|
class ListDto(BaseModel):
|
||||||
page: int = 1
|
page: int = Body(description="页数", default=1)
|
||||||
size: int = 10
|
size: int = Body(description="页面大小", default=10)
|
||||||
keyword: str = ""
|
keyword: str = Body(description="查询关键字", default="")
|
||||||
order_by_wrong_rate: bool = True
|
order_by_wrong_rate: bool = Body(alias="orderByWrongRate", description="按错误率排序", default=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user