updates
This commit is contained in:
60
Backend/src/models/page_content.py
Normal file
60
Backend/src/models/page_content.py
Normal file
@@ -0,0 +1,60 @@
|
||||
from sqlalchemy import Column, Integer, String, Text, DateTime, Boolean, Enum as SQLEnum
|
||||
from sqlalchemy.orm import relationship
|
||||
from datetime import datetime
|
||||
import enum
|
||||
|
||||
from ..config.database import Base
|
||||
|
||||
|
||||
class PageType(str, enum.Enum):
|
||||
HOME = "home"
|
||||
CONTACT = "contact"
|
||||
ABOUT = "about"
|
||||
FOOTER = "footer"
|
||||
SEO = "seo"
|
||||
|
||||
|
||||
class PageContent(Base):
|
||||
__tablename__ = "page_contents"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
page_type = Column(SQLEnum(PageType), nullable=False, unique=True, index=True)
|
||||
|
||||
# General content fields
|
||||
title = Column(String(500), nullable=True)
|
||||
subtitle = Column(String(1000), nullable=True)
|
||||
description = Column(Text, nullable=True)
|
||||
content = Column(Text, nullable=True) # Rich text content
|
||||
|
||||
# SEO fields
|
||||
meta_title = Column(String(500), nullable=True)
|
||||
meta_description = Column(Text, nullable=True)
|
||||
meta_keywords = Column(String(1000), nullable=True)
|
||||
og_title = Column(String(500), nullable=True)
|
||||
og_description = Column(Text, nullable=True)
|
||||
og_image = Column(String(1000), nullable=True)
|
||||
canonical_url = Column(String(1000), nullable=True)
|
||||
|
||||
# Contact/Footer specific fields (stored as JSON strings)
|
||||
contact_info = Column(Text, nullable=True) # JSON: phone, email, address
|
||||
map_url = Column(String(1000), nullable=True) # Google Maps embed URL
|
||||
social_links = Column(Text, nullable=True) # JSON: facebook, twitter, instagram, etc.
|
||||
footer_links = Column(Text, nullable=True) # JSON: quick links, support links
|
||||
|
||||
# Home page specific
|
||||
hero_title = Column(String(500), nullable=True)
|
||||
hero_subtitle = Column(String(1000), nullable=True)
|
||||
hero_image = Column(String(1000), nullable=True)
|
||||
|
||||
# About page specific
|
||||
story_content = Column(Text, nullable=True)
|
||||
values = Column(Text, nullable=True) # JSON array of values
|
||||
features = Column(Text, nullable=True) # JSON array of features
|
||||
|
||||
# Status
|
||||
is_active = Column(Boolean, default=True, nullable=False)
|
||||
|
||||
# Timestamps
|
||||
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
||||
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False)
|
||||
|
||||
Reference in New Issue
Block a user