update get_user_info to get_userinfo

This commit is contained in:
wu
2023-04-20 21:16:12 +08:00
parent 9b5f418e2c
commit 8dc6081c10
2 changed files with 3 additions and 3 deletions

View File

@ -72,12 +72,12 @@ class UserService:
await UserDao.reset_password(db, obj.id, obj.password2) await UserDao.reset_password(db, obj.id, obj.password2)
@staticmethod @staticmethod
async def get_user_info(username: str): async def get_userinfo(username: str):
async with async_db_session() as db: async with async_db_session() as db:
user = await UserDao.get_user_by_username(db, username) user = await UserDao.get_user_by_username(db, username)
if not user: if not user:
raise errors.NotFoundError(msg='用户不存在') raise errors.NotFoundError(msg='用户不存在')
return user return user
@staticmethod @staticmethod
async def update(*, username: str, current_user: User, obj: UpdateUser): async def update(*, username: str, current_user: User, obj: UpdateUser):

View File

@ -40,7 +40,7 @@ async def password_reset(obj: ResetPassword):
@router.get('/{username}', summary='查看用户信息', dependencies=[DependsUser]) @router.get('/{username}', summary='查看用户信息', dependencies=[DependsUser])
async def userinfo(username: str): async def userinfo(username: str):
current_user = await UserService.get_user_info(username) current_user = await UserService.get_userinfo(username)
return response_base.response_200(data=current_user, exclude={'password'}) return response_base.response_200(data=current_user, exclude={'password'})