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