Skip to content
Clone
194c44c
49 lines 1.6 KB Rust
use sea_orm::JsonValue;
use sea_orm::entity::prelude::*;
use time::OffsetDateTime;
use uuid::Uuid;
#[sea_orm::model]
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
#[sea_orm(table_name = "import_job")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
#[sea_orm(indexed)]
pub provider: String,
pub source_url: String,
pub base_url: Option<String>,
pub clone_url: String,
#[sea_orm(indexed)]
pub space_id: Uuid,
#[sea_orm(indexed)]
pub repo_id: Option<Uuid>,
pub repo_name: String,
#[sea_orm(indexed)]
pub created_by: i64,
#[sea_orm(indexed)]
pub state: String,
pub stage: String,
#[sea_orm(default_value = 0)]
pub attempts: i32,
pub last_error: Option<String>,
pub token_enc: Option<String>,
#[sea_orm(column_type = "JsonBinary")]
pub options: JsonValue,
#[sea_orm(column_type = "JsonBinary")]
pub stats: JsonValue,
pub run_after: OffsetDateTime,
pub locked_at: Option<OffsetDateTime>,
pub started_at: Option<OffsetDateTime>,
pub finished_at: Option<OffsetDateTime>,
pub created_at: OffsetDateTime,
pub updated_at: OffsetDateTime,
#[sea_orm(belongs_to, from = "space_id", to = "id")]
pub space: BelongsTo<super::super::space::spaces::Entity>,
#[sea_orm(belongs_to, from = "repo_id", to = "id")]
pub repo: BelongsTo<Option<super::super::repo::repos::Entity>>,
#[sea_orm(belongs_to, from = "created_by", to = "uid")]
pub creator: BelongsTo<super::super::users::user::Entity>,
}
impl ActiveModelBehavior for ActiveModel {}