""" Blog MVP model - BlogPost. Job ID: MTAD-IMPL-2025-11-18-CL """ from sqlalchemy import Column, String, Text, DateTime, ForeignKey from sqlalchemy.orm import relationship from sqlalchemy.sql import func from app.database import Base class BlogPost(Base): """Blog Post - Published articles and content.""" __tablename__ = "blog_posts" id = Column(String(36), primary_key=True, index=True) author_id = Column(String(36), ForeignKey("users.id"), index=True, nullable=False) title = Column(String(500), nullable=False, index=True) slug = Column(String(500), unique=True, index=True, nullable=False) content = Column(Text, nullable=False) excerpt = Column(Text, nullable=True) published_at = Column(DateTime, nullable=True, index=True) created_at = Column(DateTime, server_default=func.now(), index=True) updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now(), index=True) # Relationships author = relationship("User", back_populates="blog_posts")