Files
peter/database/thotcontent/model.py
konjacpotato 8c1a740f0b import peter
2025-11-12 20:42:16 +08:00

23 lines
1.1 KiB
Python

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"<THotContent(id={self.id}, topic_id={self.topic_id}, url={self.url}, content_upvote_count={self.content_upvote_count})>"