Spaces:
Sleeping
Sleeping
| from dataclasses import dataclass, asdict | |
| from datetime import datetime, timezone | |
| from typing import Any, Dict | |
| 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) | |
| 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() | |
| ) | |