[feat] add basic domain
This commit is contained in:
parent
a5577c1501
commit
39f28d8f30
5 changed files with 155 additions and 0 deletions
18
domain/error.py
Normal file
18
domain/error.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
class DomainError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class UserError(DomainError):
|
||||
pass
|
||||
|
||||
|
||||
class UserNotFoundError(UserError):
|
||||
def __init__(self, user_id: str) -> None:
|
||||
super().__init__('user_not_found')
|
||||
self.user_id = user_id
|
||||
|
||||
|
||||
class UserConflictError(UserError):
|
||||
def __init__(self, email: str) -> None:
|
||||
super().__init__('user_conflict')
|
||||
self.email = email
|
||||
8
domain/user.py
Normal file
8
domain/user.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True, kw_only=True)
|
||||
class User:
|
||||
id: str
|
||||
email: str
|
||||
name: str
|
||||
Loading…
Add table
Add a link
Reference in a new issue