trifid_api_entities/entity/
auth_token.rs1use sea_orm::entity::prelude::*;
4
5#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
6#[sea_orm(table_name = "auth_token")]
7pub struct Model {
8    #[sea_orm(primary_key, auto_increment = false)]
9    pub id: String,
10    pub user: String,
11    pub expires_on: i64,
12}
13
14#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
15pub enum Relation {
16    #[sea_orm(
17        belongs_to = "super::user::Entity",
18        from = "Column::User",
19        to = "super::user::Column::Id",
20        on_update = "Cascade",
21        on_delete = "Cascade"
22    )]
23    User,
24}
25
26impl Related<super::user::Entity> for Entity {
27    fn to() -> RelationDef {
28        Relation::User.def()
29    }
30}
31
32impl ActiveModelBehavior for ActiveModel {}