From 178ac334a0a72208b069a26a4281eb821b0c83a2 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Mon, 26 Jun 2023 11:51:54 +0800 Subject: [PATCH] fix comments --- app/db/models/downloadhistory.py | 12 ++++++++++ app/db/models/site.py | 16 ++++++++++++++ app/db/models/siteicon.py | 4 ++++ app/db/models/subscribe.py | 15 +++++++++++++ app/db/models/systemconfig.py | 2 ++ app/db/models/transferhistory.py | 18 ++++++++++++++- app/db/models/user.py | 7 ++++++ app/schemas/history.py | 38 ++++++++++++++++++++++++++++++++ app/schemas/response.py | 3 +++ app/schemas/site.py | 16 ++++++++++++++ app/schemas/subscribe.py | 15 +++++++++++++ app/schemas/token.py | 1 + app/schemas/user.py | 5 +++++ 13 files changed, 151 insertions(+), 1 deletion(-) diff --git a/app/db/models/downloadhistory.py b/app/db/models/downloadhistory.py index 239701ed..ab10a34e 100644 --- a/app/db/models/downloadhistory.py +++ b/app/db/models/downloadhistory.py @@ -9,21 +9,33 @@ class DownloadHistory(Base): 下载历史记录 """ id = Column(Integer, Sequence('id'), primary_key=True, index=True) + # 保存路径 path = Column(String, nullable=False, index=True) + # 类型 电影/电视剧 type = Column(String, nullable=False) + # 标题 title = Column(String, nullable=False) + # 年份 year = Column(String) tmdbid = Column(Integer, index=True) imdbid = Column(String) tvdbid = Column(Integer) doubanid = Column(String) + # Sxx seasons = Column(Integer) + # Exx episodes = Column(String) + # 海报 image = Column(String) + # 下载任务Hash download_hash = Column(String, index=True) + # 种子名称 torrent_name = Column(String) + # 种子描述 torrent_description = Column(String) + # 种子站点 torrent_site = Column(String) + # 附加信息 note = Column(String) @staticmethod diff --git a/app/db/models/site.py b/app/db/models/site.py index eb3d2c72..058114a7 100644 --- a/app/db/models/site.py +++ b/app/db/models/site.py @@ -11,21 +11,37 @@ class Site(Base): 站点表 """ id = Column(Integer, Sequence('id'), primary_key=True, index=True) + # 站点名 name = Column(String, nullable=False) + # 域名Key domain = Column(String, index=True) + # 站点地址 url = Column(String, nullable=False) + # 站点优先级 pri = Column(Integer) + # RSS地址,未启用 rss = Column(String) + # Cookie cookie = Column(String) + # User-Agent ua = Column(String) + # 是否使用代理 0-否,1-是 proxy = Column(Integer) + # 过滤规则 filter = Column(String) + # 是否渲染 render = Column(Integer) + # 附加信息 note = Column(String) + # 流控单位周期 limit_interval = Column(Integer, default=0) + # 流控次数 limit_count = Column(Integer, default=0) + # 流控间隔 limit_seconds = Column(Integer, default=0) + # 是否启用 is_active = Column(Boolean(), default=True) + # 创建时间 lst_mod_date = Column(String, default=datetime.now().strftime("%Y-%m-%d %H:%M:%S")) @staticmethod diff --git a/app/db/models/siteicon.py b/app/db/models/siteicon.py index e608e4e2..ef4ca692 100644 --- a/app/db/models/siteicon.py +++ b/app/db/models/siteicon.py @@ -9,9 +9,13 @@ class SiteIcon(Base): 站点图标表 """ id = Column(Integer, Sequence('id'), primary_key=True, index=True) + # 站点名称 name = Column(String, nullable=False) + # 域名Key domain = Column(String, index=True) + # 图标地址 url = Column(String, nullable=False) + # 图标Base64 base64 = Column(String) @staticmethod diff --git a/app/db/models/subscribe.py b/app/db/models/subscribe.py index 02961917..49ae82f8 100644 --- a/app/db/models/subscribe.py +++ b/app/db/models/subscribe.py @@ -9,24 +9,39 @@ class Subscribe(Base): 订阅表 """ id = Column(Integer, Sequence('id'), primary_key=True, index=True) + # 标题 name = Column(String, nullable=False, index=True) + # 年份 year = Column(String) + # 类型 type = Column(String) + # 搜索关键字 keyword = Column(String) tmdbid = Column(Integer, index=True) imdbid = Column(String) tvdbid = Column(Integer, index=True) doubanid = Column(String) + # 季号 season = Column(Integer) + # 海报 image = Column(String) + # 简介 description = Column(String) + # 过滤规则 filter = Column(String) + # 包含 include = Column(String) + # 排除 exclude = Column(String) + # 总集数 total_episode = Column(Integer) + # 开始集数 start_episode = Column(Integer) + # 缺失集数 lack_episode = Column(Integer) + # 附加信息 note = Column(String) + # 状态:N-新建, R-订阅中 state = Column(String, nullable=False, index=True, default='N') @staticmethod diff --git a/app/db/models/systemconfig.py b/app/db/models/systemconfig.py index 7e32120e..99b38eb9 100644 --- a/app/db/models/systemconfig.py +++ b/app/db/models/systemconfig.py @@ -9,7 +9,9 @@ class SystemConfig(Base): 配置表 """ id = Column(Integer, Sequence('id'), primary_key=True, index=True) + # 主键 key = Column(String, index=True) + # 值 value = Column(String, nullable=True) @staticmethod diff --git a/app/db/models/transferhistory.py b/app/db/models/transferhistory.py index 74050134..9fcc907e 100644 --- a/app/db/models/transferhistory.py +++ b/app/db/models/transferhistory.py @@ -1,6 +1,6 @@ import time -from sqlalchemy import Column, Integer, String, Sequence +from sqlalchemy import Column, Integer, String, Sequence, Boolean from sqlalchemy.orm import Session from app.db.models import Base @@ -11,21 +11,37 @@ class TransferHistory(Base): 转移历史记录 """ id = Column(Integer, Sequence('id'), primary_key=True, index=True) + # 源目录 src = Column(String, index=True) + # 目标目录 dest = Column(String) + # 转移模式 move/copy/link... mode = Column(String) + # 类型 电影/电视剧 type = Column(String) + # 二级分类 category = Column(String) + # 标题 title = Column(String, index=True) + # 年份 year = Column(String) tmdbid = Column(Integer) imdbid = Column(String) tvdbid = Column(Integer) doubanid = Column(String) + # Sxx seasons = Column(Integer) + # Exx episodes = Column(String) + # 海报 image = Column(String) + # 下载器hash download_hash = Column(String) + # 转移成功状态 + status = Column(Boolean(), default=True) + # 转移失败信息 + errmsg = Column(String) + # 时间 date = Column(String, index=True, default=time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) @staticmethod diff --git a/app/db/models/user.py b/app/db/models/user.py index f2d40683..98764be8 100644 --- a/app/db/models/user.py +++ b/app/db/models/user.py @@ -9,12 +9,19 @@ class User(Base): """ 用户表 """ + # ID id = Column(Integer, Sequence('id'), primary_key=True, index=True) + # 用户名 name = Column(String, index=True, nullable=False) + # 邮箱,未启用 email = Column(String, unique=True, index=True) + # 加密后密码 hashed_password = Column(String, nullable=False) + # 是否启用 is_active = Column(Boolean(), default=True) + # 是否管理员 is_superuser = Column(Boolean(), default=False) + # 头像 avatar = Column(String) @staticmethod diff --git a/app/schemas/history.py b/app/schemas/history.py index 9e9e1b2b..271dcb58 100644 --- a/app/schemas/history.py +++ b/app/schemas/history.py @@ -4,22 +4,39 @@ from pydantic import BaseModel class DownloadHistory(BaseModel): + # ID id: int + # 保存路程 path: Optional[str] = None + # 类型:电影、电视剧 type: Optional[str] = None + # 标题 title: Optional[str] = None + # 年份 year: Optional[str] = None + # TMDBID tmdbid: Optional[int] = None + # IMDBID imdbid: Optional[str] = None + # TVDBID tvdbid: Optional[int] = None + # 豆瓣ID doubanid: Optional[str] = None + # 季Sxx seasons: Optional[str] = None + # 集Exx episodes: Optional[str] = None + # 海报 image: Optional[str] = None + # 下载器Hash download_hash: Optional[str] = None + # 种子名称 torrent_name: Optional[str] = None + # 种子描述 torrent_description: Optional[str] = None + # 站点 torrent_site: Optional[str] = None + # 备注 note: Optional[str] = None class Config: @@ -27,22 +44,43 @@ class DownloadHistory(BaseModel): class TransferHistory(BaseModel): + # ID id: int + # 源目录 src: Optional[str] = None + # 目的目录 dest: Optional[str] = None + # 转移模式link/copy/move/softlink mode: Optional[str] = None + # 类型:电影、电视剧 type: Optional[str] = None + # 二级分类 category: Optional[str] = None + # 标题 title: Optional[str] = None + # 年份 year: Optional[str] = None + # TMDBID tmdbid: Optional[int] = None + # IMDBID imdbid: Optional[str] = None + # TVDBID tvdbid: Optional[int] = None + # 豆瓣ID doubanid: Optional[str] = None + # 季Sxx seasons: Optional[str] = None + # 集Exx episodes: Optional[str] = None + # 海报 image: Optional[str] = None + # 下载器Hash download_hash: Optional[str] = None + # 状态 1-成功,0-失败 + status: bool = True + # 失败原因 + errmsg: Optional[str] = None + # 日期 date: Optional[str] = None class Config: diff --git a/app/schemas/response.py b/app/schemas/response.py index d1a515cb..0cb40f77 100644 --- a/app/schemas/response.py +++ b/app/schemas/response.py @@ -4,6 +4,9 @@ from pydantic import BaseModel class Response(BaseModel): + # 状态 success: bool + # 消息文本 message: Optional[str] = None + # 数据 data: Optional[dict] = {} diff --git a/app/schemas/site.py b/app/schemas/site.py index 954d46c9..0c59393f 100644 --- a/app/schemas/site.py +++ b/app/schemas/site.py @@ -4,21 +4,37 @@ from pydantic import BaseModel class Site(BaseModel): + # ID id: int + # 站点名称 name: str + # 站点主域名Key domain: str + # 站点地址 url: str + # 站点优先级 pri: Optional[int] = 0 + # RSS地址 rss: Optional[str] = None + # Cookie cookie: Optional[str] = None + # User-Agent ua: Optional[str] = None + # 是否使用代理 proxy: Optional[int] = 0 + # 过滤规则 filter: Optional[str] = None + # 是否演染 render: Optional[int] = 0 + # 备注 note: Optional[str] = None + # 流控单位周期 limit_interval: Optional[int] = 0 + # 流控次数 limit_count: Optional[int] = 0 + # 流控间隔 limit_seconds: Optional[int] = 0 + # 是否启用 is_active: Optional[bool] = True class Config: diff --git a/app/schemas/subscribe.py b/app/schemas/subscribe.py index d08f1ce4..1205b7d1 100644 --- a/app/schemas/subscribe.py +++ b/app/schemas/subscribe.py @@ -5,22 +5,37 @@ from pydantic import BaseModel class Subscribe(BaseModel): id: int + # 订阅名称 name: str + # 订阅年份 year: str + # 订阅类型 电影/电视剧 type: str + # 搜索关键字 keyword: Optional[str] tmdbid: int doubanid: Optional[str] + # 季号 season: Optional[int] + # 海报 image: Optional[str] + # 描述 description: Optional[str] + # 过滤规则 filter: Optional[str] + # 包含 include: Optional[str] + # 排除 exclude: Optional[str] + # 总集数 total_episode: Optional[int] + # 开始集数 start_episode: Optional[int] + # 缺失集数 lack_episode: Optional[int] + # 附加信息 note: Optional[str] + # 状态:N-新建, R-订阅中 state: str class Config: diff --git a/app/schemas/token.py b/app/schemas/token.py index ea85b460..b1dbf230 100644 --- a/app/schemas/token.py +++ b/app/schemas/token.py @@ -9,4 +9,5 @@ class Token(BaseModel): class TokenPayload(BaseModel): + # 用户ID sub: Optional[int] = None diff --git a/app/schemas/user.py b/app/schemas/user.py index 26b43540..8a162255 100644 --- a/app/schemas/user.py +++ b/app/schemas/user.py @@ -5,10 +5,15 @@ from pydantic import BaseModel # Shared properties class UserBase(BaseModel): + # 用户名 name: str + # 邮箱,未启用 email: Optional[str] = None + # 状态 is_active: Optional[bool] = True + # 超级管理员 is_superuser: bool = False + # 头像 avatar: Optional[str] = None