fix: key_type stored as bare string instead of JSON string
**Problem**: - key_type stored as "user" (with quotes, len=6) - Future WHERE key_type = 'user' would silently fail **Solution**: - Added ApiKeyType::as_str() method - Returns bare string: "system", "user", etc. - handlers.rs:437 now uses as_str() instead of serde_json::to_string() **Impact**: - Existing test keys in test DBs can be safely ignored - Production DB has no api_keys yet - No code relies on JSON-quoted format
This commit is contained in:
@@ -16,6 +16,16 @@ pub enum ApiKeyType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ApiKeyType {
|
impl ApiKeyType {
|
||||||
|
pub fn as_str(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
ApiKeyType::System => "system",
|
||||||
|
ApiKeyType::User => "user",
|
||||||
|
ApiKeyType::Service => "service",
|
||||||
|
ApiKeyType::Integration => "integration",
|
||||||
|
ApiKeyType::Emergency => "emergency",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn prefix(&self) -> &'static str {
|
pub fn prefix(&self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
ApiKeyType::System => "msys_",
|
ApiKeyType::System => "msys_",
|
||||||
|
|||||||
Reference in New Issue
Block a user