feat: add backend rule group and permission support
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class RuleGroupBindingVO(BaseModel):
|
||||
"""二级分组下的规则集绑定。"""
|
||||
|
||||
id: int = Field(..., description="绑定ID")
|
||||
group_id: int = Field(..., description="分组ID")
|
||||
rule_set_id: int = Field(..., description="规则集ID")
|
||||
rule_type_binding_id: int | None = Field(None, description="镜像的运行时绑定ID")
|
||||
priority: int = Field(0, description="优先级")
|
||||
is_active: bool = Field(True, description="是否启用")
|
||||
note: str | None = Field(None, description="备注")
|
||||
rule_type: str | None = Field(None, description="规则类型编码")
|
||||
rule_name: str | None = Field(None, description="规则集名称")
|
||||
current_version_id: int | None = Field(None, description="当前版本ID")
|
||||
fallback_version_id: int | None = Field(None, description="回退版本ID")
|
||||
has_usable_version: bool = Field(False, description="是否存在可用版本")
|
||||
usable_rule_count: int = Field(0, description="可用规则数")
|
||||
|
||||
|
||||
class EvaluationPointGroupVO(BaseModel):
|
||||
"""评查点分组详情。"""
|
||||
|
||||
id: int = Field(..., description="分组ID")
|
||||
pid: int | None = Field(None, description="父分组ID")
|
||||
name: str = Field(..., description="分组名称")
|
||||
code: str = Field(..., description="分组编码")
|
||||
description: str | None = Field(None, description="分组描述")
|
||||
document_type_id: int | None = Field(None, description="关联文档类型ID")
|
||||
document_type_name: str | None = Field(None, description="关联文档类型名称")
|
||||
entry_module_id: int | None = Field(None, description="入口模块ID")
|
||||
entry_module_name: str | None = Field(None, description="入口模块名称")
|
||||
sort_order: int = Field(0, description="排序")
|
||||
is_enabled: bool = Field(True, description="是否启用")
|
||||
created_at: str | None = Field(None, description="创建时间")
|
||||
updated_at: str | None = Field(None, description="更新时间")
|
||||
rule_count: int | None = Field(None, description="绑定的规则集数量")
|
||||
bindings: list[RuleGroupBindingVO] = Field(default_factory=list, description="二级分组绑定的规则集")
|
||||
children: list["EvaluationPointGroupVO"] | None = Field(None, description="子分组")
|
||||
|
||||
|
||||
class EvaluationPointGroupListVO(BaseModel):
|
||||
"""评查点分组列表分页。"""
|
||||
|
||||
data: list[EvaluationPointGroupVO] = Field(default_factory=list, description="分组列表")
|
||||
total: int = Field(0, description="总数")
|
||||
page: int = Field(1, description="页码")
|
||||
page_size: int = Field(20, description="分页大小")
|
||||
|
||||
|
||||
class DocTypeInfoVO(BaseModel):
|
||||
"""换绑提示中的文档类型信息。"""
|
||||
|
||||
id: int = Field(..., description="文档类型ID")
|
||||
name: str = Field(..., description="文档类型名称")
|
||||
|
||||
|
||||
class EvaluationPointGroupDeleteVO(BaseModel):
|
||||
"""删除分组响应。"""
|
||||
|
||||
success: bool = Field(..., description="是否成功")
|
||||
message: str | None = Field(None, description="提示信息")
|
||||
deleted_count: int | None = Field(None, description="兼容字段")
|
||||
deleted_groups: int | None = Field(None, description="删除的分组数")
|
||||
deleted_points: int | None = Field(None, description="兼容旧字段:已删除绑定数")
|
||||
need_rebind: bool = Field(False, description="是否需要先换绑")
|
||||
points_count: int | None = Field(None, description="兼容旧字段")
|
||||
single_bound_doc_types: list[DocTypeInfoVO] = Field(default_factory=list, description="兼容旧字段")
|
||||
multi_bound_doc_types: list[DocTypeInfoVO] = Field(default_factory=list, description="兼容旧字段")
|
||||
|
||||
|
||||
class EvaluationPointGroupRebindVO(BaseModel):
|
||||
"""换绑结果。"""
|
||||
|
||||
success: bool = Field(..., description="是否成功")
|
||||
message: str = Field(..., description="结果消息")
|
||||
rebind_count: int = Field(0, description="迁移的二级分组数量")
|
||||
doc_types_updated: int = Field(0, description="兼容字段")
|
||||
|
||||
|
||||
class EvaluationPointGroupBatchStatusVO(BaseModel):
|
||||
"""批量更新状态结果。"""
|
||||
|
||||
success: bool = Field(..., description="是否成功")
|
||||
updated_count: int = Field(0, description="更新数量")
|
||||
message: str = Field(..., description="结果消息")
|
||||
|
||||
|
||||
class EvaluationPointGroupBatchDeleteVO(BaseModel):
|
||||
"""批量删除结果。"""
|
||||
|
||||
success: bool = Field(..., description="是否成功")
|
||||
deleted_groups: int = Field(0, description="删除的分组数量")
|
||||
deleted_points: int = Field(0, description="兼容旧字段:删除的绑定数量")
|
||||
message: str = Field(..., description="结果消息")
|
||||
|
||||
|
||||
EvaluationPointGroupVO.model_rebuild()
|
||||
Reference in New Issue
Block a user