refactor(notification): 建立通知渠道通用管理契约 channel_manage

- schemas 层新增 NotificationAction 公共动作词汇表(状态/二维码/退出/连通性/缓存迁移)
- 模块实现统一 channel_manage(channel, action, **params),按渠道名路由,
  非本渠道返回 None;动作语义、表单参数解释与临时参数初始化封闭在模块内
- NotificationChain 收敛为单一 manage_channel 纯透明转发,
  chain 层不再出现任何渠道名与模块特色
- endpoint 路由路径保持前端兼容,内部统一走通用接口
- 新增 6 项契约守护测试,文档记录通用模式:新渠道接入无需改 chain
This commit is contained in:
jxxghp
2026-08-16 06:35:46 +08:00
parent a66cbe6192
commit 5b0c631f80
6 changed files with 242 additions and 252 deletions
+18
View File
@@ -491,6 +491,24 @@ class MessageChannel(Enum):
QQ = "QQ"
class NotificationAction(str, Enum):
"""
通知渠道通用管理动作
作为渠道管理契约的公共词汇表,具体动作的支持范围与参数语义由渠道模块自行解释
"""
# 查询登录状态与二维码
STATUS = "status"
# 刷新登录二维码
REFRESH_QRCODE = "refresh_qrcode"
# 退出登录
LOGOUT = "logout"
# 测试连通性
TEST_CONNECTION = "test_connection"
# 迁移渠道名变更前的登录缓存
MIGRATE_CACHE = "migrate_cache"
# 下载器类型
class DownloaderType(Enum):
# Qbittorrent