This commit is contained in:
aaron 2025-04-13 00:53:59 +08:00
parent 3823af638d
commit 1b6b1f8429

View File

@ -122,11 +122,12 @@ async def create_clothing(
async def read_clothes(
skip: int = Query(0, ge=0),
limit: int = Query(100, ge=1, le=100),
category_id: int = Query(None, ge=0),
db: AsyncSession = Depends(get_db),
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])