mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-08 11:01:35 +00:00
pass strong type
This commit is contained in:
1 parent
cb5abeff08
commit
de780b0355
4 files changed
+7
-4
No files matched your search
Generated
+1
@@ -7304,6 +7304,7 @@ name = "mysql_queries"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"artcraft_api_keys",
|
||||
"bucket_paths",
|
||||
"chrono",
|
||||
"composite_identifiers",
|
||||
|
||||
@@ -20,6 +20,7 @@ path = "src/lib.rs"
|
||||
workspace-build-acceleration.workspace = true
|
||||
|
||||
# Internal
|
||||
artcraft_api_keys.workspace = true
|
||||
bucket_paths.workspace = true
|
||||
composite_identifiers = { path = "../../../schema/public/composite_identifiers" }
|
||||
enums = { workspace = true, features = ["database"] }
|
||||
|
||||
@@ -2,6 +2,7 @@ use std::marker::PhantomData;
|
||||
|
||||
use sqlx::{Executor, MySql};
|
||||
|
||||
use artcraft_api_keys::ArtcraftApiKey;
|
||||
use tokens::tokens::api_keys::ApiKeyToken;
|
||||
use tokens::tokens::users::UserToken;
|
||||
|
||||
@@ -13,7 +14,7 @@ where
|
||||
pub ip_address: &'e str,
|
||||
pub name: &'e str,
|
||||
pub maybe_description: Option<&'e str>,
|
||||
pub api_key: &'e str,
|
||||
pub api_key: &'e ArtcraftApiKey,
|
||||
pub mysql_executor: E,
|
||||
pub phantom: PhantomData<&'c E>,
|
||||
}
|
||||
@@ -44,7 +45,7 @@ SET
|
||||
created_at = NOW()
|
||||
"#,
|
||||
token.as_str(),
|
||||
args.api_key,
|
||||
args.api_key.as_str_be_careful(), // NB: This is okay in this case.
|
||||
args.name,
|
||||
args.maybe_description,
|
||||
args.owner_user_token.as_str(),
|
||||
|
||||
+2
-2
@@ -75,7 +75,7 @@ pub async fn create_api_key_handler(
|
||||
ip_address: &ip_address,
|
||||
name: &name,
|
||||
maybe_description: maybe_description.as_deref(),
|
||||
api_key: api_key.as_str_be_careful(),
|
||||
api_key: &api_key,
|
||||
mysql_executor: &mut *conn,
|
||||
phantom: PhantomData,
|
||||
}).await.map_err(|err| {
|
||||
@@ -88,6 +88,6 @@ pub async fn create_api_key_handler(
|
||||
api_key_token: token,
|
||||
// Return the full secret value (never the redacted Debug/Display form). This is the only
|
||||
// time it is ever exposed.
|
||||
api_key: api_key.to_string_be_careful(),
|
||||
api_key: api_key.to_string_be_careful(), // NB: This is okay in this case
|
||||
}))
|
||||
}
|
||||
Reference in new issue
Block a user