use sea_orm::JsonValue; use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; use time::OffsetDateTime; use uuid::Uuid; #[derive( Debug, Clone, Copy, PartialEq, Eq, Default, EnumIter, DeriveActiveEnum, Serialize, Deserialize, utoipa::ToSchema, )] #[serde(rename_all = "snake_case")] #[sea_orm(rs_type = "i16", db_type = "SmallInteger")] pub enum WorkflowStepState { #[default] #[sea_orm(num_value = 0)] Pending, #[sea_orm(num_value = 1)] Running, #[sea_orm(num_value = 2)] Success, #[sea_orm(num_value = 3)] Failure, #[sea_orm(num_value = 4)] Skipped, #[sea_orm(num_value = 5)] Cancelled, } #[sea_orm::model] #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "workflow_step")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: Uuid, #[sea_orm(indexed)] pub job_id: Uuid, pub step_index: i32, pub name: String, pub script: String, pub step_key: Option, pub stage: Option, pub outcome: Option, pub conclusion: Option, #[sea_orm(column_type = "JsonBinary")] pub outputs: Option, #[sea_orm(column_type = "JsonBinary")] pub annotations: Option, pub summary: Option, pub shell: Option, pub working_directory: Option, pub state: WorkflowStepState, pub exit_code: Option, pub started_at: Option, pub finished_at: Option, pub created_at: OffsetDateTime, pub updated_at: OffsetDateTime, #[sea_orm(belongs_to, from = "job_id", to = "id")] pub job: BelongsTo, } impl ActiveModelBehavior for ActiveModel {}