Merge #16 into develop from feature/20251219_xjn

feat(apikey system): service api key update optimization

* feature/20251219_xjn: (1 commits)
  feat(apikey system): service api key update optimization

Signed-off-by: 谢俊男 <accounts_6853d0ea6f8174722fb0c8f1@mail.teambition.com>
Reviewed-by: zhuwenhui5566@163.com <zhuwenhui5566@163.com>
Merged-by: zhuwenhui5566@163.com <zhuwenhui5566@163.com>

CR-link: https://codeup.aliyun.com/redbearai/python/redbear-mem-open/change/16
This commit is contained in:
朱文辉
2025-12-19 18:16:59 +08:00
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