Skip to content

Commit

Permalink
feat: 规则审计-策略新增/编辑-后端接口 --story=121513458
Browse files Browse the repository at this point in the history
【新增】
1. 审计策略列表接口支持对无标签进行筛选
【修复】
1. 联表标签列表返回的数量异常
  • Loading branch information
0RAJA committed Jan 14, 2025
1 parent 2c90173 commit 542befe
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/backend/services/web/strategy_v2/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ def perform_request(self, validated_request_data):
queryset = queryset.filter(
strategy_id__in=[s.strategy_id for s in resource.strategy_v2.list_has_update_strategy()]
)
if NO_TAG_ID in validated_request_data.get("tag", []):
validated_request_data["tag"] = [t for t in validated_request_data["tag"] if t != NO_TAG_ID]
queryset = queryset.exclude(strategy_id__in=StrategyTag.objects.values_list("strategy_id").distinct())
# tag filter
if validated_request_data.get("tag"):
# tag 筛选
Expand Down Expand Up @@ -1007,9 +1010,9 @@ def perform_request(self, validated_request_data):
{
"tag_name": str(NO_TAG_NAME),
"tag_id": NO_TAG_ID,
"link_table_count": LinkTable.objects.exclude(
uid__in=LinkTableTag.objects.values_list("link_table_uid").distinct()
).count(),
"link_table_count": LinkTable.list_max_version_link_table()
.exclude(uid__in=LinkTableTag.objects.values_list("link_table_uid").distinct())
.count(),
}
] + tag_count
# response
Expand Down

0 comments on commit 542befe

Please sign in to comment.