update
This commit is contained in:
parent
210f0643df
commit
b62b4dfb2e
@ -18,8 +18,6 @@ class UserCreate(UserBase):
|
||||
|
||||
class UserUpdate(UserBase):
|
||||
"""更新用户请求模型"""
|
||||
openid: Optional[str] = None
|
||||
unionid: Optional[str] = None
|
||||
avatar: Optional[str] = None
|
||||
nickname: Optional[str] = None
|
||||
|
||||
|
||||
@ -48,6 +48,7 @@ async def update_user(db: AsyncSession, user_id: int, user_update: UserUpdate):
|
||||
|
||||
# 更新用户数据
|
||||
for key, value in update_data.items():
|
||||
if value is not None:
|
||||
setattr(db_user, key, value)
|
||||
|
||||
await db.commit()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user