mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-04 23:17:20 +08:00
refactor(notification): 建立通知渠道通用管理契约 channel_manage
- schemas 层新增 NotificationAction 公共动作词汇表(状态/二维码/退出/连通性/缓存迁移) - 模块实现统一 channel_manage(channel, action, **params),按渠道名路由, 非本渠道返回 None;动作语义、表单参数解释与临时参数初始化封闭在模块内 - NotificationChain 收敛为单一 manage_channel 纯透明转发, chain 层不再出现任何渠道名与模块特色 - endpoint 路由路径保持前端兼容,内部统一走通用接口 - 新增 6 项契约守护测试,文档记录通用模式:新渠道接入无需改 chain
This commit is contained in:
@@ -212,6 +212,15 @@ exceptions and value domains used by both modules and upper layers live in
|
||||
method names. The directory remains unchanged because discovery and plugin code
|
||||
depend on this established runtime root.
|
||||
|
||||
Channels that need login management or temporary-parameter initialization
|
||||
follow one generic contract instead of per-channel APIs: modules implement
|
||||
`channel_manage(channel, action, **params)`, route by the requested
|
||||
`MessageChannel` (returning `None` for other channels), and interpret actions
|
||||
from the shared `schemas.types.NotificationAction` vocabulary plus opaque form
|
||||
parameters themselves. `NotificationChain.manage_channel` forwards transparently
|
||||
and must stay free of any channel-specific names or logic; new channels adopt
|
||||
the same contract without touching the chain.
|
||||
|
||||
### DB / Oper layer
|
||||
|
||||
SQLAlchemy models stay under `app/db/models/`; the data access classes live in
|
||||
|
||||
Reference in New Issue
Block a user