Skip to main content

modo_session/
entity.rs

1/// SeaORM entity for the `modo_sessions` table.
2///
3/// This is an internal storage type.  Application code should use
4/// [`crate::SessionData`] (returned by [`crate::SessionStore`] and
5/// [`crate::SessionManager`]) rather than this entity directly.
6#[modo_db::entity(table = "modo_sessions")]
7#[entity(framework)]
8#[entity(index(columns = ["token_hash"], unique))]
9#[entity(index(columns = ["user_id"]))]
10#[entity(index(columns = ["expires_at"]))]
11pub struct Session {
12    #[entity(primary_key, auto = "ulid")]
13    pub id: String,
14    pub token_hash: String,
15    pub user_id: String,
16    pub ip_address: String,
17    #[entity(column_type = "Text")]
18    pub user_agent: String,
19    pub device_name: String,
20    pub device_type: String,
21    pub fingerprint: String,
22    #[entity(column_type = "Text")]
23    pub data: String,
24    pub created_at: modo_db::chrono::DateTime<modo_db::chrono::Utc>,
25    pub last_active_at: modo_db::chrono::DateTime<modo_db::chrono::Utc>,
26    pub expires_at: modo_db::chrono::DateTime<modo_db::chrono::Utc>,
27}