Added `background_image_url`, `foreground_image_url`, and `asset_image_urls` fields to enhance theme customization. Updated `asset_image_urls` to use `MutableDict` with a default empty dictionary and ensured consistency in the model and migration script.
28 lines
938 B
Python
28 lines
938 B
Python
from typing import Dict
|
|
|
|
from sqlalchemy import Column, String, JSON, Boolean
|
|
from sqlalchemy.ext.mutable import MutableDict
|
|
from sqlalchemy.orm import relationship
|
|
from .base import Base, TimestampMixin, UUIDMixin
|
|
|
|
|
|
class EventTheme(Base, UUIDMixin, TimestampMixin):
|
|
__tablename__ = 'event_themes'
|
|
|
|
name = Column(String, nullable=False)
|
|
description = Column(String)
|
|
preview_image_url = Column(String)
|
|
background_image_url = Column(String, nullable=True)
|
|
foreground_image_url = Column(String, nullable=True)
|
|
asset_image_urls: Dict[str, str] = Column(MutableDict.as_mutable(JSON), default=dict)
|
|
|
|
color_palette = Column(JSON, nullable=False)
|
|
fonts = Column(JSON, nullable=False)
|
|
is_active = Column(Boolean, default=True, nullable=False)
|
|
|
|
|
|
# Relationship with Event
|
|
events = relationship("Event", back_populates="theme")
|
|
|
|
def __repr__(self):
|
|
return f"<EventTheme {self.name}>" |