mirror of
https://github.com/fastapi-practices/fastapi_best_architecture.git
synced 2025-08-19 15:47:35 +08:00
update get_user_info to get_userinfo
This commit is contained in:
@ -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):
|
||||||
|
@ -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'})
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user