from dataclasses import dataclass from datetime import datetime from typing import Optional from sqlalchemy import Column, Integer, String, BIGINT, TIMESTAMP, func from sqlalchemy.dialects.postgresql import BIGINT from database.database import Base @dataclass class THotContent(Base): __tablename__ = 't_hot_content' id: int = Column(BIGINT, primary_key=True, autoincrement=True, comment='序号') topic_id: int = Column(BIGINT, nullable=False, comment='关联话题ID') url: Optional[str] = Column(String, nullable=True, comment='内容链接') content: Optional[str] = Column(String, nullable=True, comment='内容详情') content_upvote_count: Optional[int] = Column(BIGINT, nullable=True, comment='内容点赞数量') content_comment_count: Optional[int] = Column(Integer, nullable=True, comment='内容评论数量') create_time: datetime = Column(TIMESTAMP(timezone=True), server_default=func.now(), nullable=False, comment='创建时间') def __repr__(self): return f""