python-dependency-injector/examples/miniapps/use-cases/example/usecases.py
2021-09-30 19:01:31 -04:00

23 lines
445 B
Python

"""Use cases module."""
import abc
from .adapters import EmailSender
class UseCase(metaclass=abc.ABCMeta):
@abc.abstractmethod
def execute(self) -> None:
...
class SignupUseCase:
def __init__(self, email_sender: EmailSender) -> None:
self.email_sender = email_sender
def execute(self, email: str) -> None:
print(f"Sign up user {email}")
self.email_sender.send(email, f"Welcome, {email}")