PicoBot/src/scheduler/types.rs
xiaoski 62f4326131 refactor: move scheduler store to storage module, cron tools to tools module
- storage/scheduler.rs: ScheduledJob/JobRun types + CRUD on Storage
- tools/cron.rs: 6 cron agent tools (add/list/remove/enable/disable/update)
- scheduler/types.rs: keep only Schedule enum
- scheduler/mod.rs: use Arc<Storage> instead of raw SqlitePool
- gateway/mod.rs: inject Storage directly, replace pool field
- storage/mod.rs: scheduler tables in init_schema
2026-05-05 00:49:54 +08:00

17 lines
608 B
Rust

use serde::{Deserialize, Serialize};
/// How a job is scheduled. Serialized as JSON in the database `schedule` column.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "type")]
pub enum Schedule {
/// One-shot: fires once at a specific Unix millisecond timestamp, then disables.
#[serde(rename = "at")]
At { at: i64 },
/// Recurring: fires every `every_ms` milliseconds.
#[serde(rename = "every")]
Every { every_ms: u64 },
/// Recurring: fires on a cron schedule with optional timezone.
#[serde(rename = "cron")]
Cron { expr: String, tz: Option<String> },
}