mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-17 21:22:56 +00:00
9e7637203a
移除 `aiomysql` 依赖 添加 `SQLAlchemy` `sqlmodel` `asyncmy` 依赖
17 lines
461 B
Python
17 lines
461 B
Python
from .models import User
|
|
from .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: User
|
|
"""
|
|
user = await self._repository.get_by_user_id(user_id)
|
|
return user
|