use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(table_name = "upload_jobs")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
pub upload_id: Uuid,
pub kind: String,
pub status: String,
#[sea_orm(column_type = "Text", nullable)]
pub error: Option<String>,
pub attempts: i32,
pub started_at: Option<DateTimeWithTimeZone>,
pub completed_at: Option<DateTimeWithTimeZone>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::uploads::Entity",
from = "Column::UploadId",
to = "super::uploads::Column::Id",
on_update = "Cascade",
on_delete = "Cascade"
)]
Uploads,
}
impl Related<super::uploads::Entity> for Entity {
fn to() -> RelationDef {
Relation::Uploads.def()
}
}
impl ActiveModelBehavior for ActiveModel {}
⭐
Log in to mark this repository.
1.1 KiB · text
History
c20d4f7