From be6e2cb6cd5e8551b193f2cdeb19a9a3fe5e3e39 Mon Sep 17 00:00:00 2001 From: DenebTM Date: Sat, 10 Feb 2024 13:18:08 +0100 Subject: [PATCH] add last_used to user_tokens table --- src/auth.rs | 2 -- src/db.rs | 11 ++++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/auth.rs b/src/auth.rs index 08643d3..7a57701 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -21,8 +21,6 @@ impl Authenticator { #[instrument] pub async fn create_user_token(&mut self, username: &str, password: &Password) -> UserToken { - // let created = - let mut token_str = "".to_owned(); let mut rng = thread_rng(); diff --git a/src/db.rs b/src/db.rs index 35f7198..37df86b 100644 --- a/src/db.rs +++ b/src/db.rs @@ -36,11 +36,12 @@ impl SqliteDatabase { query( "CREATE TABLE IF NOT EXISTS {TABLE_USER_TOKENS} ( id INTEGER PRIMARY KEY AUTOINCREMENT, - username VARCHAR(255), - token NCHAR(30), - created DATETIME, - valid BOOLEAN, - );", + username VARCHAR(255) NOT NULL, + token NCHAR(30) NOT NULL, + valid BOOLEAN NOT NULL, + created DATETIME NOT NULL, + last_used DATETIME + )", ) .execute(&mut self.conn) .await