core: type platform api key timestamps

This commit is contained in:
a.tolmachev
2026-04-13 06:28:58 +00:00
parent c736b4f5a8
commit dddbbac745
8 changed files with 58 additions and 38 deletions
+1 -3
View File
@@ -1584,9 +1584,7 @@ async fn require_platform_api_key(
return Err(StatusCode::FORBIDDEN);
}
let used_at = OffsetDateTime::now_utc()
.format(&Rfc3339)
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
let used_at = OffsetDateTime::now_utc();
state
.registry
.touch_platform_api_key(&api_key.api_key.workspace_id, &api_key.api_key.id, &used_at)
+2 -1
View File
@@ -107,6 +107,7 @@ mod tests {
use serde_json::{Value, json};
use sha2::{Digest, Sha256};
use sqlx::{Executor, postgres::PgPoolOptions};
use time::{OffsetDateTime, format_description::well_known::Rfc3339};
use tokio::net::TcpListener;
use tokio::time::sleep;
@@ -1546,7 +1547,7 @@ mod tests {
prefix: secret.chars().take(16).collect(),
scopes: scopes.to_vec(),
status: PlatformApiKeyStatus::Active,
created_at: "2026-03-26T10:00:00Z".to_owned(),
created_at: OffsetDateTime::parse("2026-03-26T10:00:00Z", &Rfc3339).unwrap(),
last_used_at: None,
};