feat(saas): P2 增强 — TOTP 2FA、Relay 重试、配置同步升级
- TOTP 2FA: totp-rs v5.7.1 + data-encoding Base32, setup/verify/disable 流程, 登录时 TOTP 验证集成, SaasError::Totp 返回 400 - Relay 重试: 指数退避 (base_delay_ms * 2^attempt), 错误分类 (4xx 不重试), Admin POST /tasks/:id/retry 端点 - 配置同步: push (客户端覆盖) / merge (SaaS 优先) / diff (只读对比), 实际写入 config_items 表 - 集成测试: 27 个测试全部通过 (新增 6 个 P2 测试) - 文档: 更新 SaaS 平台总览 (模块完成度 + API 端点列表)
This commit is contained in:
@@ -84,8 +84,18 @@ pub async fn sync_config(
|
||||
State(state): State<AppState>,
|
||||
Extension(ctx): Extension<AuthContext>,
|
||||
Json(req): Json<SyncConfigRequest>,
|
||||
) -> SaasResult<Json<Vec<ConfigSyncLogInfo>>> {
|
||||
service::sync_config(&state.db, &ctx.account_id, &req).await.map(Json)
|
||||
) -> SaasResult<Json<super::service::ConfigSyncResult>> {
|
||||
super::service::sync_config(&state.db, &ctx.account_id, &req).await.map(Json)
|
||||
}
|
||||
|
||||
/// POST /api/v1/config/diff
|
||||
/// 计算客户端与 SaaS 端的配置差异 (不修改数据)
|
||||
pub async fn config_diff(
|
||||
State(state): State<AppState>,
|
||||
Extension(_ctx): Extension<AuthContext>,
|
||||
Json(req): Json<SyncConfigRequest>,
|
||||
) -> SaasResult<Json<ConfigDiffResponse>> {
|
||||
service::compute_config_diff(&state.db, &req).await.map(Json)
|
||||
}
|
||||
|
||||
/// GET /api/v1/config/sync-logs
|
||||
|
||||
Reference in New Issue
Block a user