from dataclasses import dataclass from datetime import datetime from typing import Optional from sqlalchemy import Column, String, Integer, TIMESTAMP, func from sqlalchemy.dialects.postgresql import BIGINT from database.database import Base @dataclass class THotTopic(Base): __tablename__ = 't_hot_topic' id: int = Column(BIGINT, primary_key=True, autoincrement=True, comment='序号') topic: str = Column(String, nullable=False, comment='话题') topic_description: Optional[str] = Column(String, nullable=True, comment='话题描述') url: Optional[str] = Column(String, nullable=True, comment='话题链接') source: Optional[str] = Column(String, nullable=True, comment='话题来源') keywords: Optional[str] = Column(String, nullable=True, comment='话题关键词') content_count: int = Column(Integer, default=0, nullable=False, comment='话题内容数量') comment_count: int = Column(Integer, default=0, nullable=False, comment='话题评论数量') follower_count: int = Column(Integer, default=0, nullable=False, comment='话题关注者数量') date_created: Optional[datetime] = Column(TIMESTAMP(timezone=True), nullable=True, comment='话题创建时间') date_modified: Optional[datetime] = Column(TIMESTAMP(timezone=True), nullable=True, comment='话题修改时间') top_content_url: Optional[str] = Column(String, nullable=True, comment='热内内容链接') top_content_upvote_count: Optional[int] = Column(BIGINT, nullable=True, comment='热门内容点赞数量') top_content_comment_count: Optional[int] = Column(Integer, nullable=True, comment='热门内容评论数量') create_time: datetime = Column(TIMESTAMP(timezone=True), server_default=func.now(), nullable=False, comment='创建时间') update_time: Optional[datetime] = Column(TIMESTAMP(timezone=True), server_default=func.now(), nullable=False, comment='更新时间') ai_script: Optional[str] = Column(String, nullable=True, comment='内容脚本') def __repr__(self): return f""