-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd6c15a
commit 0a566c1
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ pub mod accounts; | |
pub mod subscriptions; | ||
pub mod users; | ||
pub mod users_accounts; | ||
pub mod tasks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub use super::accounts::Entity as Accounts; | ||
pub use super::subscriptions::Entity as Subscriptions; | ||
pub use super::tasks::Entity as Tasks; | ||
pub use super::users::Entity as Users; | ||
pub use super::users_accounts::Entity as UsersAccounts; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use sea_orm::entity::prelude::*; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, EnumIter, DeriveActiveEnum)] | ||
#[sea_orm(rs_type = "i16", db_type = "Integer")] | ||
pub enum TaskState { | ||
Created = 0, | ||
Scheduled = 1, | ||
Running = 2, | ||
Failed = 3, | ||
Canceled = 4, | ||
Completed = 5, | ||
} | ||
|
||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] | ||
#[sea_orm(table_name = "tasks")] | ||
pub struct Model { | ||
#[sea_orm(primary_key)] | ||
pub id: i64, | ||
pub state: TaskState, | ||
pub priority: i16, | ||
pub attempt: i16, | ||
pub max_attempts: i16, | ||
pub created_at: DateTimeWithTimeZone, | ||
pub attempted_at: Option<DateTimeWithTimeZone>, | ||
pub scheduled_at: Option<DateTimeWithTimeZone>, | ||
#[sea_orm(column_type = "Text")] | ||
pub queue: String, | ||
#[sea_orm(column_type = "Text")] | ||
pub name: String, | ||
pub payload: Json, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] | ||
pub enum Relation {} | ||
|
||
impl ActiveModelBehavior for ActiveModel {} |