This commit is contained in:
23
database/thotcontent/model.py
Normal file
23
database/thotcontent/model.py
Normal file
@ -0,0 +1,23 @@
|
||||
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})>"
|
||||
Reference in New Issue
Block a user