wakflo_core/
workflow.rs

1use crate::step::{ConnectorStep, StepEdge};
2use serde::{Deserialize, Serialize};
3
4/// Workflow types type
5#[derive(
6    PartialEq,
7    Eq,
8    Debug,
9    Serialize,
10    Deserialize,
11    Clone,
12    strum_macros::AsRefStr,
13    strum_macros::EnumString,
14    strum_macros::IntoStaticStr,
15    Default,
16)]
17pub enum WorkflowVersionSchema {
18    #[default]
19    V1,
20}
21
22#[cfg(not(feature = "sql"))]
23impl std::fmt::Display for WorkflowVersionSchema {
24    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
25        match self {
26            WorkflowVersionSchema::V1 => write!(f, "io.wakflow.ngine/workflows/jsonschema/v1"),
27        }
28    }
29}
30
31/// # Workflow
32/// Workflow contract represent an ant workflows that takes in operators and actions
33/// to be performed on a dataset
34#[derive(PartialEq, Eq, Serialize, Deserialize, Clone, Debug)]
35pub struct Workflow {
36    /// [WorkflowSchema] workflows types definition
37    pub schema_version: WorkflowVersionSchema,
38
39    pub id: String,
40
41    pub team_id: String,
42
43    pub revision: i64,
44
45    pub enabled: bool,
46
47    pub settings: WorkflowSettings,
48
49    /// Name of the workflows
50    pub name: String,
51
52    /// Display name of the workflows
53    pub display_name: String,
54
55    /// Description of the workflows
56    pub description: Option<String>,
57
58    /// [ConnectorStep] in a workflows
59    ///
60    /// [ConnectorStep]: crate::schema::contracts::ConnectorStep
61    pub steps: Vec<ConnectorStep>,
62
63    pub step_edges: Vec<StepEdge>,
64
65    /// Date the entity was created
66    pub created_at: chrono::DateTime<chrono::FixedOffset>,
67
68    /// Date the entity was updated
69    pub updated_at: chrono::DateTime<chrono::FixedOffset>,
70}
71
72#[derive(Default, PartialEq, Serialize, Deserialize, Eq, Clone, Debug)]
73pub struct WorkflowSettings {}