[feat] add basic domain

This commit is contained in:
Azamat 2026-03-20 12:53:26 +03:00
parent a5577c1501
commit 39f28d8f30
5 changed files with 155 additions and 0 deletions

18
domain/error.py Normal file
View 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
View 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