我不知道我在这里做错了什么。我想用订单 ID 更新订单,但我得到了TypeError: dict() takes exactly 1 positional argument (0 given)
. 但是,当我更新用户时它运行良好。
@order_router.put('/update/{order_id}', response_model=Order_Pydantic)
async def update_by_order_id(order_id: str, order=OrderModel, Authorize: AuthJWT = Depends()):
try:
Authorize.jwt_required()
except Exception as e:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORISED, detail='Invalid Token'
)
await Order.filter(id=order_id).update(**order.dict(exclude_unset=True))
return Order_Pydantic.from_queryset_single(Order.get(id=order_id))