feat: use ClassifiedAdTitle value object for ClassifiedAd.title
This commit is contained in:
10
domain/marketplace/classified_ad_title.py
Normal file
10
domain/marketplace/classified_ad_title.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ClassifiedAdTitle:
|
||||
title: str
|
||||
|
||||
def __post_init__(self):
|
||||
if len(self.title) > 100:
|
||||
raise ValueError(f"Title cannot be longer than 100 characters: {self.title}")
|
||||
Reference in New Issue
Block a user