Skip to main content

zlayer_types/api/
cron.rs

1//! Cron job DTOs.
2
3use serde::{Deserialize, Serialize};
4
5/// Response for cron job information
6#[derive(Debug, Serialize, Deserialize, utoipa::ToSchema)]
7pub struct CronJobResponse {
8    /// Job name
9    pub name: String,
10    /// Cron schedule expression
11    pub schedule: String,
12    /// Whether the job is enabled
13    pub enabled: bool,
14    /// When the job last ran (ISO 8601 format)
15    #[serde(skip_serializing_if = "Option::is_none")]
16    pub last_run: Option<String>,
17    /// Next scheduled run time (ISO 8601 format)
18    #[serde(skip_serializing_if = "Option::is_none")]
19    pub next_run: Option<String>,
20}
21
22/// Response after triggering a cron job
23#[derive(Debug, Serialize, Deserialize, utoipa::ToSchema)]
24pub struct TriggerCronResponse {
25    /// Execution ID for tracking
26    pub execution_id: String,
27    /// Human-readable message
28    pub message: String,
29}
30
31/// Response for enable/disable operations
32#[derive(Debug, Serialize, Deserialize, utoipa::ToSchema)]
33pub struct CronStatusResponse {
34    /// Job name
35    pub name: String,
36    /// New enabled state
37    pub enabled: bool,
38    /// Human-readable message
39    pub message: String,
40}