scheduled tasks
This commit is contained in:
parent
0fa627ca6d
commit
937827d08b
17 changed files with 1445 additions and 136 deletions
36
src/entities/task_run.rs
Normal file
36
src/entities/task_run.rs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "task_runs")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
pub task_id: Uuid,
|
||||
pub status: String,
|
||||
#[sea_orm(column_type = "Text")]
|
||||
pub logs: String,
|
||||
#[sea_orm(column_type = "Text", nullable)]
|
||||
pub answer: Option<String>,
|
||||
pub created_at: DateTimeWithTimeZone,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::task::Entity",
|
||||
from = "Column::TaskId",
|
||||
to = "super::task::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
Task,
|
||||
}
|
||||
|
||||
impl Related<super::task::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Task.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue