use async_trait::async_trait;
use serde::{Deserialize, Serialize};
use crate::job::Job;
#[async_trait]
pub trait CronJob: Job + Send + Sync {
fn cron_expression(&self) -> &'static str;
fn cron_id(&self) -> &'static str;
fn enabled(&self) -> bool {
true
}
fn timezone(&self) -> &'static str {
"UTC"
}
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct CronJobMeta {
pub id: String,
pub name: String,
pub queue: String,
pub cron_expression: String,
pub timezone: String,
pub enabled: bool,
#[serde(default)]
pub last_run: Option<String>,
pub next_run: String,
pub created_at: String,
pub payload: String, }