MibooGram/app/user/services.py

15 lines
451 B
Python
Raw Normal View History

2022-07-26 10:07:31 +00:00
from app.user.models import User
from app.user.repositories import UserRepository
class UserService:
def __init__(self, user_repository: UserRepository) -> None:
self._repository: UserRepository = user_repository
async def get_user_by_id(self, user_id: int) -> User:
"""从数据库获取用户信息
:param user_id:用户ID
:return:
"""
return await self._repository.get_by_user_id(user_id)