fix: correct API key expiry and dashboard savings (#361)

This commit is contained in:
Entropy.Xu
2026-04-30 00:35:32 +08:00
committed by GitHub
parent 9e2faa7e5b
commit 4d59d518d1
11 changed files with 228 additions and 25 deletions

View File

@@ -45,8 +45,8 @@ pub(super) fn build_admin_user_api_key_detail_payload(
"rate_limit": record.rate_limit,
"concurrent_limit": record.concurrent_limit,
"expires_at": format_optional_unix_secs_iso8601(record.expires_at_unix_secs),
"last_used_at": serde_json::Value::Null,
"created_at": serde_json::Value::Null,
"last_used_at": format_optional_unix_secs_iso8601(record.last_used_at_unix_secs),
"created_at": format_optional_unix_secs_iso8601(record.created_at_unix_secs),
})
}

View File

@@ -171,7 +171,8 @@ pub(crate) async fn build_admin_create_user_api_key_response(
"rate_limit": created.rate_limit,
"concurrent_limit": created.concurrent_limit,
"expires_at": format_optional_unix_secs_iso8601(created.expires_at_unix_secs),
"created_at": chrono::Utc::now().to_rfc3339(),
"last_used_at": format_optional_unix_secs_iso8601(created.last_used_at_unix_secs),
"created_at": format_optional_unix_secs_iso8601(created.created_at_unix_secs),
"message": "API Key创建成功请妥善保存完整密钥",
}))
.into_response(),

View File

@@ -64,8 +64,8 @@ pub(crate) async fn build_admin_list_user_api_keys_response(
"rate_limit": record.rate_limit,
"concurrent_limit": record.concurrent_limit,
"expires_at": format_optional_unix_secs_iso8601(record.expires_at_unix_secs),
"last_used_at": serde_json::Value::Null,
"created_at": serde_json::Value::Null,
"last_used_at": format_optional_unix_secs_iso8601(record.last_used_at_unix_secs),
"created_at": format_optional_unix_secs_iso8601(record.created_at_unix_secs),
})
})
.collect::<Vec<_>>();