from dataclasses import dataclass from sqlalchemy import Column, String, Boolean, TIMESTAMP, func, INT from sqlalchemy.dialects.postgresql import BIGINT from database.database import Base @dataclass class TInformationSource(Base): __tablename__ = 't_information_source' id: int = Column(BIGINT, primary_key=True, autoincrement=True, comment='编号') title: str = Column(String, nullable=False, comment='标题') description: str = Column(String, nullable=True, comment='描述') keywords: str = Column(String, nullable=True, comment='关键字') url: str = Column(String, nullable=True, comment='网站链接') rss: str = Column(String, nullable=True, comment='RSS链接') api: str = Column(String, nullable=True, comment='API') 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='语言') priority: int = Column(INT, nullable=False, default=100, comment='优先级') active: bool = Column(Boolean, default=False, nullable=False, comment='是否启用:false未启用,true启用') module: str = Column(String, nullable=True, comment='任务逻辑所在模块名称') method: str = Column(String, nullable=True, comment='任务逻辑的函数名称') create_time: str = Column(TIMESTAMP(timezone=True), server_default=func.now(), nullable=False, comment='创建时间') update_time: str = Column(TIMESTAMP(timezone=True), server_default=func.now(), onupdate=func.now(), nullable=False, comment='更新时间') is_static: bool = Column(Boolean, default=True, nullable=False, comment='是否是静态网站:false动态,true静态') def __repr__(self): return f""