update
This commit is contained in:
parent
3823af638d
commit
1b6b1f8429
@ -122,11 +122,12 @@ async def create_clothing(
|
|||||||
async def read_clothes(
|
async def read_clothes(
|
||||||
skip: int = Query(0, ge=0),
|
skip: int = Query(0, ge=0),
|
||||||
limit: int = Query(100, ge=1, le=100),
|
limit: int = Query(100, ge=1, le=100),
|
||||||
|
category_id: int = Query(None, ge=0),
|
||||||
db: AsyncSession = Depends(get_db),
|
db: AsyncSession = Depends(get_db),
|
||||||
current_user: UserModel = Depends(get_current_user)
|
current_user: UserModel = Depends(get_current_user)
|
||||||
):
|
):
|
||||||
"""获取所有衣服"""
|
"""获取所有衣服"""
|
||||||
clothes = await clothing_service.get_clothes(db=db, skip=skip, limit=limit, user_id=current_user.id)
|
clothes = await clothing_service.get_clothes(db=db, skip=skip, limit=limit, user_id=current_user.id, category_id=category_id)
|
||||||
# 手动返回标准响应格式
|
# 手动返回标准响应格式
|
||||||
return StandardResponse(code=200, data=[Clothing.model_validate(clothing) for clothing in clothes])
|
return StandardResponse(code=200, data=[Clothing.model_validate(clothing) for clothing in clothes])
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user