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:
@@ -16,7 +16,7 @@ def generate_api_key(key_type: ApiKeyType) -> str:
|
|||||||
key_type: API Key 类型
|
key_type: API Key 类型
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
tuple: (api_key, key_hash, key_prefix)
|
str: api_key
|
||||||
"""
|
"""
|
||||||
# 前缀映射
|
# 前缀映射
|
||||||
prefix_map = {
|
prefix_map = {
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ class ApiKeyService:
|
|||||||
existing = db.scalar(
|
existing = db.scalar(
|
||||||
select(ApiKey).where(
|
select(ApiKey).where(
|
||||||
ApiKey.workspace_id == workspace_id,
|
ApiKey.workspace_id == workspace_id,
|
||||||
ApiKey.resource_id == data.resource_id,
|
ApiKey.resource_id == api_key.resource_id,
|
||||||
ApiKey.name == data.name,
|
ApiKey.name == data.name,
|
||||||
ApiKey.is_active,
|
ApiKey.is_active,
|
||||||
ApiKey.id != api_key_id
|
ApiKey.id != api_key_id
|
||||||
|
|||||||
Reference in New Issue
Block a user