This commit is contained in:
2026-07-06 13:56:29 +08:00
parent 9c69e3b67a
commit 0aa47f455a
+4 -14
View File
@@ -267,24 +267,14 @@ async def get_me(
name_map = await batch_get_team_name_map(db, [current_user.team_id])
team_name = name_map.get(current_user.team_id)
# 显式构造 dict 避免 Pydantic 扫描 ORM 对象触发懒加载
user_dict = {
"id": current_user.id,
"username": current_user.username,
"email": current_user.email,
"phone": current_user.phone,
"avatar": current_user.avatar,
"credits": current_user.credits,
"is_admin": current_user.is_admin,
"user_type": current_user.user_type,
"allowed_menus": current_user.allowed_menus,
"must_set_password": bool(current_user.user_type == "frontend" and not current_user.hashed_password),
return UserOut.model_validate(current_user).model_copy(
update={
"resource_capacity": resource_capacity,
"is_team_manager": is_team_manager,
"team_id": current_user.team_id,
"team_name": team_name,
"is_team_manager": is_team_manager,
}
return UserOut(**user_dict)
)
@router.post(