eba4fd1
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<String>,
pub stage: Option<String>,
pub outcome: Option<String>,
pub conclusion: Option<String>,
#[sea_orm(column_type = "JsonBinary")]
pub outputs: Option<JsonValue>,
#[sea_orm(column_type = "JsonBinary")]
pub annotations: Option<JsonValue>,
pub summary: Option<String>,
pub shell: Option<String>,
pub working_directory: Option<String>,
pub state: WorkflowStepState,
pub exit_code: Option<i32>,
pub started_at: Option<OffsetDateTime>,
pub finished_at: Option<OffsetDateTime>,
pub created_at: OffsetDateTime,
pub updated_at: OffsetDateTime,
#[sea_orm(belongs_to, from = "job_id", to = "id")]
pub job: BelongsTo<super::workflow_job::Entity>,
}
impl ActiveModelBehavior for ActiveModel {}