37 lines
1.8 KiB
Python
37 lines
1.8 KiB
Python
"""
|
|
@model StorefrontContentModel (Backend/app/models/StorefrontContentModel.py)
|
|
@purpose Unified CMS model for storefront layouts, hero sliders, promo cards, trust badges, and scheduled widgets.
|
|
"""
|
|
import enum
|
|
from sqlalchemy import Column, String, Integer, Boolean, DateTime, Enum, JSON
|
|
from app.models.db_base import Base
|
|
from app.models.audit_base import AuditBaseMixin
|
|
|
|
class ContentStatusEnum(str, enum.Enum):
|
|
DRAFT = "DRAFT"
|
|
PUBLISHED = "PUBLISHED"
|
|
SCHEDULED = "SCHEDULED"
|
|
ARCHIVED = "ARCHIVED"
|
|
|
|
class StorefrontContent(Base, AuditBaseMixin):
|
|
__tablename__ = "storefront_contents"
|
|
|
|
content_id = Column(String(36), primary_key=True, index=True)
|
|
page = Column(String(64), nullable=False, index=True, default="home")
|
|
region = Column(String(64), nullable=False, index=True, default="hero")
|
|
type = Column(String(64), nullable=False, index=True, default="hero_banner")
|
|
slug = Column(String(128), unique=True, index=True, nullable=False)
|
|
title = Column(String(255), nullable=False)
|
|
subtitle = Column(String(500), nullable=True)
|
|
image_url = Column(String(1000), nullable=True)
|
|
button_text = Column(String(128), nullable=True)
|
|
button_url = Column(String(500), nullable=True)
|
|
status = Column(Enum(ContentStatusEnum), default=ContentStatusEnum.PUBLISHED, nullable=False, index=True)
|
|
published_version = Column(Integer, nullable=True, default=1)
|
|
display_order = Column(Integer, default=0, nullable=False, index=True)
|
|
start_at = Column(DateTime(timezone=True), nullable=True)
|
|
end_at = Column(DateTime(timezone=True), nullable=True)
|
|
is_featured = Column(Boolean, default=False, nullable=False)
|
|
locale = Column(String(16), default="en_US", nullable=False)
|
|
tenant_id = Column(String(36), nullable=True)
|
|
metadata_json = Column(JSON, nullable=True)
|