File size: 718 Bytes
71b4454 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | from dataclasses import dataclass, asdict
from datetime import datetime, timezone
from typing import Any, Dict
@dataclass
class CMSProject:
project_id: str
html: str = ""
css: str = ""
components: Any = None
styles: Any = None
updated_at: str = ""
def to_dict(self) -> Dict[str, Any]:
return asdict(self)
@classmethod
def create(cls, project_id: str, **data: Any) -> "CMSProject":
return cls(
project_id=project_id,
html=data.get("html", ""),
css=data.get("css", ""),
components=data.get("components"),
styles=data.get("styles"),
updated_at=datetime.now(timezone.utc).isoformat()
)
|