mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-01 13:37:24 +08:00
refactor(api): 渠道与存储管理端点通用化,端点层零目标特色
- schemas 新增公共 ManageRequest(target+action+params) 与 StorageAction 词汇表
- endpoint 层收敛为 POST /notification/manage、/storage/manage 两个通用接口,
不再定义任何渠道/存储特定的名称、参数与响应字段,前端上送参数原样透传
- chain 层 manage_channel/manage_storage 接受字符串标识纯透明转发,
StorageChain 移除全部特色管理方法
- FileManagerModule 新增 storage_manage 统一入口,模块返回归一化为
{success, message, data};wechatclawbot channel_manage 同步归一化,
路由标识兼容枚举名/值/对象
- dashboard 与 agentopsassistant 的用量查询改走 manage_storage(usage)
- 新增 10 项存储契约守护测试,通知侧补充 3 项链透传与字符串路由测试,
API 守护测试对 ManageRequest 开放映射按设计豁免
This commit is contained in:
@@ -212,14 +212,23 @@ 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.
|
||||
Channels and storages that need login management or temporary-parameter
|
||||
initialization follow one generic contract instead of per-target APIs: modules
|
||||
implement `channel_manage(channel, action, **params)` or
|
||||
`storage_manage(storage, action, **params)`, route by the requested target
|
||||
identifier (returning `None` for other targets, accepting both enum members
|
||||
and plain strings), and interpret actions from the shared
|
||||
`schemas.types.NotificationAction` / `StorageAction` vocabulary plus opaque
|
||||
form parameters themselves. All results use the unified
|
||||
`{"success": bool, "message": ..., "data": ...}` shape.
|
||||
`NotificationChain.manage_channel` and `StorageChain.manage_storage` forward
|
||||
transparently and must stay free of any channel/storage-specific names or
|
||||
logic; new channels or storages adopt the same contract without touching the
|
||||
chains. The endpoint layer exposes this as two generic endpoints
|
||||
(`POST /api/v1/notification/manage`, `POST /api/v1/storage/manage`) taking the
|
||||
common `schemas.ManageRequest` body (`target` + `action` + `params`) and must
|
||||
never define target-specific names, parameters or response fields — the
|
||||
frontend supplies them and the endpoint passes them through untouched.
|
||||
|
||||
### DB / Oper layer
|
||||
|
||||
|
||||
Reference in New Issue
Block a user