feat(apikey system): service api key update optimization

This commit is contained in:
谢俊男
2025-12-19 11:31:09 +08:00
parent 45db8fd1bf
commit 3fbd4f206e
2 changed files with 2 additions and 2 deletions

View File

@@ -16,7 +16,7 @@ def generate_api_key(key_type: ApiKeyType) -> str:
key_type: API Key 类型
Returns:
tuple: (api_key, key_hash, key_prefix)
str: api_key
"""
# 前缀映射
prefix_map = {

View File

@@ -143,7 +143,7 @@ class ApiKeyService:
existing = db.scalar(
select(ApiKey).where(
ApiKey.workspace_id == workspace_id,
ApiKey.resource_id == data.resource_id,
ApiKey.resource_id == api_key.resource_id,
ApiKey.name == data.name,
ApiKey.is_active,
ApiKey.id != api_key_id