This commit is contained in:
29
database/tmaterial/model.py
Normal file
29
database/tmaterial/model.py
Normal file
@ -0,0 +1,29 @@
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
from sqlalchemy import Column, String, Boolean, DateTime, BigInteger, text, INT
|
||||
from database.database import Base
|
||||
|
||||
@dataclass
|
||||
class TMaterial(Base):
|
||||
__tablename__ = 't_material'
|
||||
|
||||
id: int = Column(BigInteger, primary_key=True, autoincrement=True, comment='编号')
|
||||
title: Optional[str] = Column(String, nullable=True, comment='标题')
|
||||
summary: Optional[str] = Column(String, nullable=True, comment='摘要')
|
||||
url: Optional[str] = Column(String, nullable=True, comment='链接')
|
||||
content: Optional[str] = Column(String, nullable=True, comment='内容/正文')
|
||||
occurrence_date: Optional[datetime] = Column(DateTime(timezone=True), nullable=True, comment='发布日期')
|
||||
source: Optional[str] = Column(String, nullable=True, comment='来源')
|
||||
primary_category: str = Column(String, nullable=True, comment='一级类别')
|
||||
secondary_category: str = Column(String, nullable=True, comment='二级类别')
|
||||
tertiary_category: str = Column(String, nullable=True, comment='三级类别')
|
||||
label: str = Column(String, nullable=True, comment='标签')
|
||||
lang: str = Column(String, nullable=False, default='zh', comment='语言')
|
||||
quality_score: int = Column(INT, nullable=True, comment='质量评分')
|
||||
ai_summary: Optional[str] = Column(String, nullable=True, comment='AI摘要')
|
||||
ai_title: Optional[str] = Column(String, nullable=True, comment='AI标题')
|
||||
ai_content: Optional[str] = Column(String, nullable=True, comment='AI正文')
|
||||
is_usage: bool = Column(Boolean, nullable=False, default=False, server_default=text('false'), comment='是否已用')
|
||||
create_time: datetime = Column(DateTime(timezone=True), nullable=False, server_default=text('now()'), comment='创建日期')
|
||||
Reference in New Issue
Block a user