mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 17:47:02 +03:00
23 lines
445 B
Python
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}")
|