//! SeaORM Entity. Generated by sea-orm-codegen 0.9.3 use sea_orm::entity::prelude::*; use crate::session_trait::UserSession; #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] #[sea_orm(table_name = "admin_session")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: Uuid, pub admin_id: Option, pub ip_address: String, pub created_at: DateTime, pub expires_at: DateTime, pub updated_at: DateTime, } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation { #[sea_orm( belongs_to = "super::admin::Entity", from = "Column::AdminId", to = "super::admin::Column::Id", on_update = "Cascade", on_delete = "Cascade" )] Admin, } impl Related for Entity { fn to() -> RelationDef { Relation::Admin.def() } } impl ActiveModelBehavior for ActiveModel {} #[async_trait::async_trait] impl UserSession for Model { async fn id(&self) -> Uuid { self.id } async fn expires_at(&self) -> chrono::NaiveDateTime { self.expires_at } }