chore: add legacy binding fallback audit logs
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import logging
|
||||
from fastapi_common.fastapi_common_sqlalchemy.database import GetAsyncSession
|
||||
from fastapi_common.fastapi_common_web.domain.responses import StatusCodeEnum
|
||||
from fastapi_common.fastapi_common_web.exception.LeauditException import LeauditException
|
||||
@@ -21,6 +22,8 @@ from fastapi_modules.fastapi_leaudit.services import IOssService, IRuleService
|
||||
from fastapi_modules.fastapi_leaudit.services.impl.ossServiceImpl import OssServiceImpl
|
||||
from fastapi_modules.fastapi_leaudit.services.impl.ruleGroupSupport import sync_doc_type_bindings_from_group
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class RuleServiceImpl(IRuleService):
|
||||
"""规则服务实现。"""
|
||||
@@ -756,6 +759,13 @@ class RuleServiceImpl(IRuleService):
|
||||
if not Row:
|
||||
raise LeauditException(StatusCodeEnum.HTTP_404_NOT_FOUND, "绑定记录不存在")
|
||||
|
||||
LOGGER.warning(
|
||||
"rule binding legacy fallback hit on update: binding_id=%s doc_type_id=%s rule_set_id=%s",
|
||||
BindingId,
|
||||
Row.get("doc_type_id"),
|
||||
Row.get("rule_set_id"),
|
||||
)
|
||||
|
||||
SetClauses: list[str] = []
|
||||
Params: dict[str, object] = {"bid": BindingId}
|
||||
|
||||
@@ -838,6 +848,11 @@ class RuleServiceImpl(IRuleService):
|
||||
text("DELETE FROM leaudit_rule_type_bindings WHERE id = :bid"),
|
||||
{"bid": BindingId},
|
||||
)
|
||||
if Result.rowcount:
|
||||
LOGGER.warning(
|
||||
"rule binding legacy fallback hit on delete: binding_id=%s",
|
||||
BindingId,
|
||||
)
|
||||
await Session.commit()
|
||||
if Result.rowcount == 0:
|
||||
raise LeauditException(StatusCodeEnum.HTTP_404_NOT_FOUND, "绑定记录不存在")
|
||||
|
||||
Reference in New Issue
Block a user