feat: update last time used api key
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
use sqlx::PgPool;
|
||||
use uuid::Uuid;
|
||||
|
||||
pub async fn update_last_access(pool: &PgPool, api_key_id: Uuid) -> Result<(), sqlx::Error> {
|
||||
sqlx::query!(
|
||||
r#"
|
||||
UPDATE auth.api_key
|
||||
SET last_used_at = now()
|
||||
WHERE id = $1
|
||||
"#,
|
||||
api_key_id
|
||||
)
|
||||
.execute(pool)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -1,2 +1,3 @@
|
||||
pub mod api_key;
|
||||
pub mod pool;
|
||||
pub mod user_repository;
|
||||
|
||||
Reference in New Issue
Block a user