:)
This commit is contained in:
commit
1c273e1fc0
46 changed files with 7589 additions and 0 deletions
39
src/db/schemas/user_token.rs
Normal file
39
src/db/schemas/user_token.rs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.14
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "user_token")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
pub user_id: i32,
|
||||
pub token: String,
|
||||
pub note: Option<String>,
|
||||
pub enabled: bool,
|
||||
pub expiration_time: Option<DateTime>,
|
||||
pub creation_time: DateTime,
|
||||
pub last_edit_time: Option<DateTime>,
|
||||
pub last_usage_time: Option<DateTime>,
|
||||
pub version: i32,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::user::Entity",
|
||||
from = "Column::UserId",
|
||||
to = "super::user::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
User,
|
||||
}
|
||||
|
||||
impl Related<super::user::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::User.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
Reference in a new issue