rusty-bever/src/db/tokens.rs

21 lines
459 B
Rust

use uuid::Uuid;
use diesel::{Queryable, Insertable};
use crate::schema::refresh_tokens;
#[derive(Queryable)]
pub struct RefreshToken {
pub token: Vec<u8>,
pub user_id: Uuid,
pub expires_at: chrono::NaiveDateTime,
pub last_used_at: Option<chrono::NaiveDateTime>,
}
#[derive(Insertable)]
#[table_name = "refresh_tokens"]
pub struct NewRefreshToken {
pub token: Vec<u8>,
pub user_id: Uuid,
pub expires_at: chrono::NaiveDateTime,
}