feat(scheduler): 定时任务后端持久化 + Pipeline trigger 编译修复

S4/S8 定时任务后端:
- 新增 scheduled_tasks 表 (migration v7)
- 新增 scheduled_task CRUD 模块 (handlers/service/types)
- 注册 /api/scheduler/tasks 路由 (GET/POST/PATCH/DELETE)
- 新增 start_user_task_scheduler() 30秒轮询循环
- 支持 cron/interval/once 三种调度类型
- once 类型执行后自动禁用

修复:
- pipeline_commands.rs: 修复 pipeline.trigger 字段不存在的编译错误
  (Pipeline 结构体无 trigger 字段,改用 metadata.tags/description)
This commit is contained in:
iven
2026-03-30 19:46:45 +08:00
parent c2aff09811
commit a0bbd4ba82
10 changed files with 457 additions and 5 deletions

View File

@@ -0,0 +1,15 @@
//! 用户定时任务管理模块
pub mod types;
pub mod service;
pub mod handlers;
use axum::routing::{get, post, patch, delete};
use crate::state::AppState;
/// 定时任务路由 (需要认证)
pub fn routes() -> axum::Router<AppState> {
axum::Router::new()
.route("/api/scheduler/tasks", get(handlers::list_tasks).post(handlers::create_task))
.route("/api/scheduler/tasks/:id", get(handlers::get_task).patch(handlers::update_task).delete(handlers::delete_task))
}