routa_core/models/
schedule.rs1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Clone, Serialize, Deserialize)]
6#[serde(rename_all = "camelCase")]
7pub struct Schedule {
8 pub id: String,
9 pub name: String,
10 pub cron_expr: String,
11 pub task_prompt: String,
12 pub agent_id: String,
13 pub workspace_id: String,
14 pub enabled: bool,
15 #[serde(skip_serializing_if = "Option::is_none")]
16 pub last_run_at: Option<DateTime<Utc>>,
17 #[serde(skip_serializing_if = "Option::is_none")]
18 pub next_run_at: Option<DateTime<Utc>>,
19 #[serde(skip_serializing_if = "Option::is_none")]
20 pub last_task_id: Option<String>,
21 #[serde(skip_serializing_if = "Option::is_none")]
22 pub prompt_template: Option<String>,
23 pub created_at: DateTime<Utc>,
24 pub updated_at: DateTime<Utc>,
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize)]
29#[serde(rename_all = "camelCase")]
30pub struct CreateScheduleInput {
31 pub name: String,
32 pub cron_expr: String,
33 pub task_prompt: String,
34 pub agent_id: String,
35 pub workspace_id: String,
36 #[serde(default = "default_true")]
37 pub enabled: bool,
38 pub next_run_at: Option<DateTime<Utc>>,
39 pub prompt_template: Option<String>,
40}
41
42fn default_true() -> bool {
43 true
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize, Default)]
48#[serde(rename_all = "camelCase")]
49pub struct UpdateScheduleInput {
50 pub name: Option<String>,
51 pub cron_expr: Option<String>,
52 pub task_prompt: Option<String>,
53 pub agent_id: Option<String>,
54 pub enabled: Option<bool>,
55 pub next_run_at: Option<DateTime<Utc>>,
56 pub last_run_at: Option<DateTime<Utc>>,
57 pub last_task_id: Option<String>,
58 pub prompt_template: Option<String>,
59}