feat: add binding CRUD methods to IRuleService interface

This commit is contained in:
wren
2026-04-28 11:44:20 +08:00
parent 2230ea826e
commit 6d7a342c77
@@ -2,7 +2,13 @@
from abc import ABC, abstractmethod
from fastapi_modules.fastapi_leaudit.domian.vo.ruleVo import RuleSetVO, RuleVersionVO
from fastapi_modules.fastapi_leaudit.domian.vo.ruleVo import (
RuleBindingVO,
RuleContentVO,
RuleSetVO,
RuleValidationVO,
RuleVersionVO,
)
class IRuleService(ABC):
@@ -19,6 +25,77 @@ class IRuleService(ABC):
...
@abstractmethod
async def Publish(self, RuleType: str, VersionId: int) -> RuleVersionVO:
async def GetContent(self, VersionId: int) -> RuleContentVO:
"""获取指定版本的规则正文。"""
...
@abstractmethod
async def Validate(self, RuleType: str, YamlText: str) -> RuleValidationVO:
"""校验规则 YAML。"""
...
@abstractmethod
async def CreateVersion(
self,
RuleType: str,
YamlText: str,
ChangeNote: str | None = None,
EditorUserId: int | None = None,
) -> RuleVersionVO:
"""创建规则版本。"""
...
@abstractmethod
async def Publish(
self,
RuleType: str,
VersionId: int,
OperatorUserId: int | None = None,
) -> RuleVersionVO:
"""发布指定版本。"""
...
@abstractmethod
async def Rollback(
self,
RuleType: str,
VersionId: int,
OperatorUserId: int | None = None,
) -> RuleVersionVO:
"""回滚到指定历史版本。"""
...
@abstractmethod
async def ListBindings(self, RuleType: str | None = None) -> list[RuleBindingVO]:
"""列出规则类型绑定。可按规则类型过滤。"""
...
@abstractmethod
async def CreateBinding(
self,
DocTypeId: int,
RuleSetId: int,
BindingMode: str = "explicit",
Priority: int = 0,
DocTypeCode: str | None = None,
Note: str | None = None,
) -> RuleBindingVO:
"""创建规则类型绑定。"""
...
@abstractmethod
async def UpdateBinding(
self,
BindingId: int,
IsActive: bool | None = None,
Priority: int | None = None,
BindingMode: str | None = None,
Note: str | None = None,
) -> RuleBindingVO:
"""更新规则类型绑定。"""
...
@abstractmethod
async def DeleteBinding(self, BindingId: int) -> None:
"""删除规则类型绑定。"""
...