feat: complete SOP version management

This commit is contained in:
Eric 1549169735@qq.com
2026-08-08 23:29:56 +08:00
parent 4b240499c2
commit e32025d2ca
40 changed files with 966 additions and 159 deletions

View File

@@ -179,12 +179,14 @@ func ValidateForPublish(startNodeKey string, nodes []model.SOPNode, edges []mode
}
defaultPaths := map[string]int{}
conditionalPaths := map[string]int{}
for _, edge := range edges {
adjacency[edge.SourceNodeKey] = append(adjacency[edge.SourceNodeKey], edge.TargetNodeKey)
if isDefaultCondition(edge.Condition) {
defaultPaths[edge.SourceNodeKey]++
continue
}
conditionalPaths[edge.SourceNodeKey]++
var rule interface{}
if err := json.Unmarshal(edge.Condition, &rule); err != nil {
continue
@@ -196,6 +198,11 @@ func ValidateForPublish(startNodeKey string, nodes []model.SOPNode, edges []mode
problems = append(problems, fmt.Sprintf("节点 %s 配置了多条默认路径", source))
}
}
for source := range conditionalPaths {
if defaultPaths[source] == 0 {
problems = append(problems, fmt.Sprintf("节点 %s 包含条件路径但没有默认路径", source))
}
}
for _, node := range nodes {
var config map[string]interface{}