26 lines
684 B
Rust
26 lines
684 B
Rust
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "tasks")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key, auto_increment = false)]
|
|
pub id: Uuid,
|
|
pub goal: String,
|
|
pub cron: Option<String>,
|
|
pub created_at: DateTimeWithTimeZone,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(has_many = "super::task_run::Entity")]
|
|
TaskRuns,
|
|
}
|
|
|
|
impl Related<super::task_run::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::TaskRuns.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|