stormchaser_model/cron.rs
1//! Cron scheduling models for recurring workflow execution.
2
3use crate::id::CronWorkflowId;
4use chrono::{DateTime, Utc};
5use serde::{Deserialize, Serialize};
6use serde_json::Value;
7use utoipa::ToSchema;
8
9/// Represents a scheduled cron workflow configuration.
10#[derive(Debug, Serialize, Deserialize, Clone, sqlx::FromRow, ToSchema)]
11pub struct CronWorkflow {
12 /// Unique identifier for the cron workflow.
13 pub id: CronWorkflowId,
14 /// Name of the schedule.
15 pub name: String,
16 /// Optional description of the schedule's purpose.
17 pub description: Option<String>,
18 /// Cron expression defining the schedule.
19 pub cronspec: String,
20 /// Name of the workflow to run.
21 pub workflow_name: String,
22 /// URL of the Git repository containing the workflow.
23 pub repo_url: String,
24 /// Path to the workflow file within the repository.
25 pub workflow_path: String,
26 /// Git branch, tag, or commit to execute.
27 pub git_ref: String,
28 /// Default inputs to pass to the workflow run.
29 pub inputs: Value,
30 /// Secret token used to validate external triggers.
31 pub secret_token: String,
32 /// Whether the schedule is currently active and processing.
33 pub is_active: bool,
34 /// External job ID associated with this cron schedule.
35 pub external_job_id: Option<String>,
36 /// Timestamp when the schedule was created.
37 pub created_at: DateTime<Utc>,
38 /// Timestamp when the schedule was last updated.
39 pub updated_at: DateTime<Utc>,
40}