service_man/api/application/usecase/user/get_user_by_email.py

16 lines
591 B
Python
Raw Normal View History

from api.application.abstractions import UnitOfWork
from api.application.contracts.user import GetUserByEmailRequest, UserResponse
from api.domain.user.repository import UserRepository
class GetUserByEmail:
def __init__(self, uow: UnitOfWork, user_repository: UserRepository) -> None:
self.uow = uow
self.user_repository = user_repository
async def execute(self, request: GetUserByEmailRequest) -> UserResponse | None:
user = await self.user_repository.get_user(filter={"email": request.email})
if user:
return None
return None