From a578704fa1063f71af3d5dd3c83c6e8031556776 Mon Sep 17 00:00:00 2001 From: gudaoxuri Date: Fri, 26 Apr 2024 15:18:58 +0800 Subject: [PATCH] Improve code comments. --- backend/basic/src/rbum/domain/rbum_set.rs | 61 ++++- .../basic/src/rbum/domain/rbum_set_cate.rs | 36 ++- .../basic/src/rbum/domain/rbum_set_item.rs | 25 +- backend/basic/src/rbum/dto.rs | 1 - backend/basic/src/rbum/dto/rbum_filer_dto.rs | 189 ++++++++++++-- backend/basic/src/rbum/dto/rbum_safe_dto.rs | 40 --- .../basic/src/rbum/dto/rbum_set_cate_dto.rs | 110 +++++++- backend/basic/src/rbum/dto/rbum_set_dto.rs | 189 +++++++++++++- .../basic/src/rbum/dto/rbum_set_item_dto.rs | 161 +++++++++++- backend/basic/src/rbum/rbum_config.rs | 59 ++++- backend/basic/src/rbum/rbum_enumeration.rs | 244 ++++++++++++++---- backend/basic/src/rbum/serv/rbum_set_serv.rs | 34 ++- .../supports/iam/src/basic/dto/iam_set_dto.rs | 4 +- .../iam/src/basic/serv/iam_set_serv.rs | 18 +- .../api/iam_ci_account_api.rs | 6 +- .../console_interface/api/iam_ci_app_api.rs | 6 +- .../api/iam_ci_app_set_api.rs | 2 +- .../api/iam_ci_tenant_api.rs | 4 +- .../api/iam_cp_account_api.rs | 8 +- .../console_passport/api/iam_cp_app_api.rs | 4 +- .../console_tenant/api/iam_ct_account_api.rs | 2 +- .../src/console_tenant/api/iam_ct_app_api.rs | 2 +- backend/supports/reach/src/dto/message/mod.rs | 1 - 23 files changed, 1000 insertions(+), 206 deletions(-) delete mode 100644 backend/basic/src/rbum/dto/rbum_safe_dto.rs diff --git a/backend/basic/src/rbum/domain/rbum_set.rs b/backend/basic/src/rbum/domain/rbum_set.rs index f713112a6..a4aa7dfdc 100644 --- a/backend/basic/src/rbum/domain/rbum_set.rs +++ b/backend/basic/src/rbum/domain/rbum_set.rs @@ -6,22 +6,77 @@ use tardis::{TardisCreateEntity, TardisEmptyBehavior, TardisEmptyRelation}; /// Resource set model /// -/// Resource set is essentially a general tree structure processing model +/// 资源集模型 +/// +/// Resource set is essentially a general tree structure processing model. +/// +/// 资源集本质上是一个通用的树形结构处理模型。 +/// +/// ```text +/// +------------------------------------+ +/// | | +/// | rbum_set | +/// | | +/// | 1| | +/// | | | +/// | +--- * rbum_set_cate | +/// | | +/// | 1| | +/// | | | +/// | +--- * rbum_set_item | +/// | | +/// | General Tree 1| | +/// +----------------------+-------------+ +/// | +/// +--- * rbum_item +/// ``` +/// +/// * ``rbum_set`` is the tree description +/// * ``rbum_set_cate`` is the tree nodes +/// * ``rbum_set_item`` is the association between tree nodes and mounted resource items +/// (supports multiple resource items mounted on a node, and a resource item mounted on multiple nodes) +/// +/// +/// * ``rbum_set`` 是树的描述 +/// * ``rbum_set_cate`` 是树的各个节点 +/// * ``rbum_set_item`` 是树节点与挂载资源项的关联(支持一个节点挂载多个资源项,一个资源项挂载多个节点) #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, TardisCreateEntity, TardisEmptyBehavior, TardisEmptyRelation)] #[sea_orm(table_name = "rbum_set")] pub struct Model { + /// Resource set id + /// + /// 资源集id #[sea_orm(primary_key, auto_increment = false)] pub id: String, - // Set code + /// Resource set code + /// + /// 资源集编码 #[index(unique)] pub code: String, - // Set kind + /// Resource set kind + /// + /// 资源集类型 #[index] pub kind: String, + /// Resource set name + /// + /// 资源集名称 pub name: String, + /// Resource set note + /// + /// 资源集备注 pub note: String, + /// Resource set icon + /// + /// 资源集图标 pub icon: String, + /// Resource set sort + /// + /// 资源集排序 pub sort: i64, + /// Resource set extension information + /// + /// 资源集扩展信息 pub ext: String, pub scope_level: i16, diff --git a/backend/basic/src/rbum/domain/rbum_set_cate.rs b/backend/basic/src/rbum/domain/rbum_set_cate.rs index 610b01557..4f4c9b3c5 100644 --- a/backend/basic/src/rbum/domain/rbum_set_cate.rs +++ b/backend/basic/src/rbum/domain/rbum_set_cate.rs @@ -3,24 +3,54 @@ use tardis::db::sea_orm; use tardis::db::sea_orm::prelude::*; use tardis::db::sea_orm::*; use tardis::{TardisCreateEntity, TardisEmptyBehavior, TardisEmptyRelation}; -/// Resource set category model +/// Resource set category(node) model +/// +/// 资源集分类(节点)模型 +/// +/// Resource set category is essentially a node of the resource tree. +/// +/// 资源集分类本质上是资源树的一个个节点。 #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, TardisCreateEntity, TardisEmptyBehavior, TardisEmptyRelation)] #[sea_orm(table_name = "rbum_set_cate")] pub struct Model { + /// Node id + /// + /// 节点id #[sea_orm(primary_key, auto_increment = false)] pub id: String, - /// System (internal) code \ - /// using regular hierarchical code to avoid recursive tree queries + /// System (internal) code + /// + /// 系统(内部)编码 + /// + /// using regular hierarchical code to avoid recursive tree queries. + /// + /// 使用规则的层级编码,避免递归树查询。 #[index(index_id = "unique_sys_code", unique)] pub sys_code: String, /// Business code for custom + /// + /// 自定义业务编码 #[index(index_id = "bus_code")] pub bus_code: String, + /// Node name + /// + /// 节点名称 pub name: String, + /// Node icon + /// + /// 节点图标 pub icon: String, + /// Node sort + /// + /// 节点排序 pub sort: i64, + /// Node extension information + /// + /// 节点扩展信息 pub ext: String, /// Associated [resource set](crate::rbum::domain::rbum_set::Model) id + /// + /// 关联[资源集](crate::rbum::domain::rbum_set::Model) id #[index(index_id = "unique_sys_code", repeat(index_id = "bus_code"))] pub rel_rbum_set_id: String, diff --git a/backend/basic/src/rbum/domain/rbum_set_item.rs b/backend/basic/src/rbum/domain/rbum_set_item.rs index 2bc498270..0ad425222 100644 --- a/backend/basic/src/rbum/domain/rbum_set_item.rs +++ b/backend/basic/src/rbum/domain/rbum_set_item.rs @@ -3,23 +3,42 @@ use tardis::db::sea_orm; use tardis::db::sea_orm::prelude::*; use tardis::db::sea_orm::*; use tardis::{TardisCreateEntity, TardisEmptyBehavior, TardisEmptyRelation}; -/// Resource item model +/// Association model for resource set categories(nodes) and resource items /// -/// Used to bind resources to resource set categories +/// 资源集分类(节点)挂载资源项的关联模型 +/// +/// Used to bind resource items to resource set categories(nodes). +/// +/// 用于将资源项绑定到资源集分类(节点)。 #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, TardisCreateEntity, TardisEmptyBehavior, TardisEmptyRelation)] #[sea_orm(table_name = "rbum_set_cate_item")] pub struct Model { + /// Association id + /// + /// 关联id #[sea_orm(primary_key, auto_increment = false)] pub id: String, - + /// Association sort + /// + /// 关联排序 pub sort: i64, /// Associated [resource set](crate::rbum::domain::rbum_set::Model) id + /// + /// 关联[资源集](crate::rbum::domain::rbum_set::Model) id #[index(index_id = "unique_index", unique)] pub rel_rbum_set_id: String, /// Associated [resource set category](crate::rbum::domain::rbum_set_cate::Model) sys_code + /// + /// 关联[资源集分类](crate::rbum::domain::rbum_set_cate::Model) sys_code + /// + /// Avoid recursive tree queries by associating with ``sys_code``. + /// + /// 通过 ``sys_code`` 关联以避免递归树查询。 #[index(index_id = "unique_index")] pub rel_rbum_set_cate_code: String, /// Associated [resource](crate::rbum::domain::rbum_item::Model) id + /// + /// 关联[资源](crate::rbum::domain::rbum_item::Model) id #[index(repeat(index_id = "unique_index"))] pub rel_rbum_item_id: String, diff --git a/backend/basic/src/rbum/dto.rs b/backend/basic/src/rbum/dto.rs index b3c977da8..7514e1894 100644 --- a/backend/basic/src/rbum/dto.rs +++ b/backend/basic/src/rbum/dto.rs @@ -10,7 +10,6 @@ pub mod rbum_rel_agg_dto; pub mod rbum_rel_attr_dto; pub mod rbum_rel_dto; pub mod rbum_rel_env_dto; -pub mod rbum_safe_dto; pub mod rbum_set_cate_dto; pub mod rbum_set_dto; pub mod rbum_set_item_dto; diff --git a/backend/basic/src/rbum/dto/rbum_filer_dto.rs b/backend/basic/src/rbum/dto/rbum_filer_dto.rs index 876b35521..f9ea7f841 100644 --- a/backend/basic/src/rbum/dto/rbum_filer_dto.rs +++ b/backend/basic/src/rbum/dto/rbum_filer_dto.rs @@ -111,62 +111,209 @@ pub struct RbumRelExtFilterReq { pub rel_rbum_rel_id: Option, } +/// Resource set filter +/// +/// 资源集过滤器 #[derive(Serialize, Deserialize, Debug, Clone, Default)] #[cfg_attr(feature = "default", derive(poem_openapi::Object))] pub struct RbumSetFilterReq { + /// Basic filter + /// + /// 基础过滤 pub basic: RbumBasicFilterReq, + /// Resource relation filter + /// + /// 资源关联过滤 pub rel: Option, + /// Include resource kind id + /// + /// 包含的资源类型id pub kind: Option, } -#[derive(Serialize, Deserialize, Debug, Clone, Default)] -#[cfg_attr(feature = "default", derive(poem_openapi::Object))] -pub struct RbumSetTreeFilterReq { - pub fetch_cate_item: bool, - pub hide_item_with_disabled: bool, - pub hide_cate_with_empty_item: bool, - pub sys_codes: Option>, - pub sys_code_query_kind: Option, - pub sys_code_query_depth: Option, - pub cate_exts: Option>, - pub rel_rbum_item_ids: Option>, - pub rel_rbum_item_kind_ids: Option>, - pub rel_rbum_item_domain_ids: Option>, -} - +/// Resource set category(node) filter +/// +/// 资源集分类(节点)过滤器 #[derive(Serialize, Deserialize, Debug, Clone, Default)] #[cfg_attr(feature = "default", derive(poem_openapi::Object))] pub struct RbumSetCateFilterReq { + /// Basic filter + /// + /// 基础过滤 pub basic: RbumBasicFilterReq, + /// Resource relation filter + /// + /// 资源关联过滤 pub rel: Option, + /// Include resource set id + /// + /// 包含的资源集id pub rel_rbum_set_id: Option, + /// Include resource category (node) sys_codes + /// + /// 包含的资源分类(节点)sys_code 列表 pub sys_codes: Option>, + /// Resource set category(node) query kind + /// + /// 资源集分类(节点)的查询类型 + /// + /// Only valid when ``sys_codes`` exists. + /// + /// 仅当 ``sys_codes`` 存在时有效。 pub sys_code_query_kind: Option, + /// Resource set category(node) query depth + /// + /// 资源集分类(节点)查询深度 + /// + /// Only valid when ``sys_codes`` exists and ``sys_code_query_kind = CurrentAndSub or Sub``. + /// + /// 仅当 ``sys_codes`` 存在并且 ``sys_code_query_kind = CurrentAndSub or Sub`` 时有效。 pub sys_code_query_depth: Option, + /// Include resource category (node) extension information + /// + /// 包含的资源分类(节点)扩展信息 pub cate_exts: Option>, } +/// Resource set category(node) mount resource item filter +/// +/// 资源集分类(节点)挂载资源项的过滤器 #[derive(Serialize, Deserialize, Debug, Clone, Default)] #[cfg_attr(feature = "default", derive(poem_openapi::Object))] pub struct RbumSetItemFilterReq { + /// Basic filter + /// + /// 基础过滤 pub basic: RbumBasicFilterReq, + /// Include resource set id + /// + /// 包含的资源集id pub rel_rbum_set_id: Option, + /// Resource set category(node) query kind + /// + /// 资源集分类(节点)的查询类型 + /// + /// Only valid when ``sys_codes`` exists. + /// + /// 仅当 ``sys_codes`` 存在时有效。 pub sys_code_query_kind: Option, + /// Resource set category(node) query depth + /// + /// 资源集分类(节点)查询深度 + /// + /// Only valid when ``sys_codes`` exists and ``sys_code_query_kind = CurrentAndSub or Sub``. + /// + /// 仅当 ``sys_codes`` 存在并且 ``sys_code_query_kind = CurrentAndSub or Sub`` 时有效。 pub sys_code_query_depth: Option, - /// rbum_set_cate.sys_code + /// Include resource category (node) sys_codes + /// + /// 包含的资源分类(节点)sys_code 列表 pub rel_rbum_set_cate_sys_codes: Option>, - /// rbum_set_item.rbum_set_item - pub rel_rbum_set_item_cate_code: Option, - /// default is inner join - pub table_rbum_set_cate_is_left: Option, + /// Include resource category (node) ids + /// + /// 包含的资源分类(节点)id 列表 pub rel_rbum_set_cate_ids: Option>, - pub rel_rbum_item_disabled: Option, + /// Include resource category (node) code + /// + /// 包含的资源分类(节点)code + pub rel_rbum_set_item_cate_code: Option, + /// Whether the associated resource item can not exist + /// + /// 关联的资源项是否可以不存在 + /// + /// Default is ``true`` + /// + /// 默认为 ``true`` + pub rel_rbum_item_can_not_exist: Option, + /// Include the associated resource item ids + /// + /// 包含关联的资源项id列表 pub rel_rbum_item_ids: Option>, + /// Include the associated resource item scope level + /// + /// 包含关联的资源项作用域级别 pub rel_rbum_item_scope_level: Option, + /// Include the associated resource item kind ids + /// + /// 包含关联的资源项类型id列表 + pub rel_rbum_item_kind_ids: Option>, + /// Include the associated resource item domain ids + /// + /// 包含关联的资源项域id列表 + pub rel_rbum_item_domain_ids: Option>, + /// Whether the associated resource item is disabled + /// + /// 关联的资源项是否已禁用 + pub rel_rbum_item_disabled: Option, +} + +/// Resource set filter +/// +/// 资源集过滤器 +#[derive(Serialize, Deserialize, Debug, Clone, Default)] +#[cfg_attr(feature = "default", derive(poem_openapi::Object))] +pub struct RbumSetTreeFilterReq { + /// Whether to get the associated resource items + /// + /// 是否获取关联的资源项 + pub fetch_cate_item: bool, + /// Whether to not get the associated resource items and the disabled ones + /// + /// 是否不获取包含关联的且已禁用的资源项 + /// + /// Only valid when ``fetch_cate_item = true``. + /// + /// 仅当 ``fetch_cate_item = true`` 时有效。 + pub hide_item_with_disabled: bool, + /// Whether to filter out nodes that do not have associated resource items + /// + /// 返回的树是否过滤掉没有关联资源项的节点 + /// + /// Only valid when ``fetch_cate_item = true``. + /// + /// 仅当 ``fetch_cate_item = true`` 时有效。 + pub hide_cate_with_empty_item: bool, + /// Include resource category (node) sys_codes + /// + /// 包含的资源分类(节点)sys_code 列表 + pub sys_codes: Option>, + /// Resource set category(node) query kind + /// + /// 资源集分类(节点)的查询类型 + /// + /// Only valid when ``sys_codes`` exists. + /// + /// 仅当 ``sys_codes`` 存在时有效。 + pub sys_code_query_kind: Option, + /// Resource set category(node) query depth + /// + /// 资源集分类(节点)查询深度 + /// + /// Only valid when ``sys_codes`` exists and ``sys_code_query_kind = CurrentAndSub or Sub``. + /// + /// 仅当 ``sys_codes`` 存在并且 ``sys_code_query_kind = CurrentAndSub or Sub`` 时有效。 + pub sys_code_query_depth: Option, + /// Include resource category (node) extension information + /// + /// 包含的资源分类(节点)扩展信息 + pub cate_exts: Option>, + /// Include the associated resource item ids + /// + /// 包含关联的资源项id列表 + pub rel_rbum_item_ids: Option>, + /// Include the associated resource item kind ids + /// + /// 包含关联的资源项类型id列表 pub rel_rbum_item_kind_ids: Option>, + /// Include the associated resource item domain ids + /// + /// 包含关联的资源项域id列表 pub rel_rbum_item_domain_ids: Option>, } +/// Resource relation filter +/// +/// 资源关联过滤器 #[derive(Serialize, Deserialize, Debug, Clone, Default)] #[cfg_attr(feature = "default", derive(poem_openapi::Object))] #[serde(default)] diff --git a/backend/basic/src/rbum/dto/rbum_safe_dto.rs b/backend/basic/src/rbum/dto/rbum_safe_dto.rs deleted file mode 100644 index 58723a537..000000000 --- a/backend/basic/src/rbum/dto/rbum_safe_dto.rs +++ /dev/null @@ -1,40 +0,0 @@ -use serde::Serialize; -#[cfg(feature = "default")] -use tardis::db::sea_orm; -use tardis::{ - chrono::{DateTime, Utc}, - web::poem_openapi, -}; -#[derive(Debug, Clone, Default, Serialize)] -#[cfg_attr(feature = "default", derive(poem_openapi::Object, sea_orm::FromQueryResult))] -pub struct RbumSafeSummaryResp { - pub id: String, - pub own_paths: String, - pub owner: String, - pub create_time: DateTime, - pub update_time: DateTime, -} - -impl RbumSafeSummaryResp { - pub fn extends_to_detail_resp(self, owner_name: impl Into) -> RbumSafeDetailResp { - RbumSafeDetailResp { - id: self.id, - own_paths: self.own_paths, - owner: self.owner, - owner_name: owner_name.into(), - create_time: self.create_time, - update_time: self.update_time, - } - } -} - -#[derive(Debug, Clone, Serialize)] -#[cfg_attr(feature = "default", derive(poem_openapi::Object, sea_orm::FromQueryResult))] -pub struct RbumSafeDetailResp { - pub id: String, - pub own_paths: String, - pub owner: String, - pub owner_name: String, - pub create_time: DateTime, - pub update_time: DateTime, -} diff --git a/backend/basic/src/rbum/dto/rbum_set_cate_dto.rs b/backend/basic/src/rbum/dto/rbum_set_cate_dto.rs index 243ee69b5..16cd39237 100644 --- a/backend/basic/src/rbum/dto/rbum_set_cate_dto.rs +++ b/backend/basic/src/rbum/dto/rbum_set_cate_dto.rs @@ -8,53 +8,125 @@ use tardis::web::poem_openapi; use crate::rbum::rbum_enumeration::RbumScopeLevelKind; +/// Add request for resource set category(node) +/// +/// 资源集分类(节点)添加请求 #[derive(Serialize, Deserialize, Debug)] #[cfg_attr(feature = "default", derive(poem_openapi::Object))] pub struct RbumSetCateAddReq { + /// Business code for custom + /// + /// 自定义业务编码 #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "255")))] pub bus_code: TrimString, + /// Node name + /// + /// 节点名称 #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "255")))] pub name: TrimString, + /// Node icon + /// + /// 节点图标 #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "1000")))] pub icon: Option, + /// Node sort + /// + /// 节点排序 pub sort: Option, + /// Node extension information + /// + /// 节点扩展信息 #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "1000")))] pub ext: Option, - #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "1000")))] - pub rbum_parent_cate_id: Option, + /// Associated [resource set](crate::rbum::dto::rbum_set_dto::RbumSetDetailResp) id + /// + /// 关联[资源集](crate::rbum::dto::rbum_set_dto::RbumSetDetailResp) id #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "255")))] pub rel_rbum_set_id: String, + /// Parent node id + /// + /// 父节点id + #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "1000")))] + pub rbum_parent_cate_id: Option, pub scope_level: Option, } +/// Modify request for resource set category(node) +/// +/// 资源集分类(节点)修改请求 #[derive(Serialize, Deserialize, Debug)] #[cfg_attr(feature = "default", derive(poem_openapi::Object))] pub struct RbumSetCateModifyReq { + /// Business code for custom + /// + /// 自定义业务编码 #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "255")))] pub bus_code: Option, + /// Node name + /// + /// 节点名称 #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "255")))] pub name: Option, + /// Node icon + /// + /// 节点图标 #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "1000")))] pub icon: Option, + /// Node sort + /// + /// 节点排序 pub sort: Option, + /// Node extension information + /// + /// 节点扩展信息 #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "1000")))] pub ext: Option, pub scope_level: Option, } +/// Resource set category(node) summary information +/// +/// 资源集分类(节点)概要信息 #[derive(Serialize, Deserialize, Debug)] #[cfg_attr(feature = "default", derive(poem_openapi::Object, sea_orm::FromQueryResult))] pub struct RbumSetCateSummaryResp { + /// Node id + /// + /// 节点id pub id: String, + /// System (internal) code + /// + /// 系统(内部)编码 + /// + /// using regular hierarchical code to avoid recursive tree queries. + /// + /// 使用规则的层级编码,避免递归树查询。 pub sys_code: String, + /// Business code for custom + /// + /// 自定义业务编码 pub bus_code: String, + /// Node name + /// + /// 节点名称 pub name: String, + /// Node icon + /// + /// 节点图标 pub icon: String, + /// Node sort + /// + /// 节点排序 pub sort: i64, + /// Node extension information + /// + /// 节点扩展信息 pub ext: String, - + /// Associated [resource set](crate::rbum::dto::rbum_set_dto::RbumSetSummaryResp) id + /// + /// 关联[资源集](crate::rbum::dto::rbum_set_dto::RbumSetSummaryResp) id pub rel_rbum_set_id: String, pub own_paths: String, @@ -65,17 +137,47 @@ pub struct RbumSetCateSummaryResp { pub scope_level: RbumScopeLevelKind, } +/// Resource set category(node) detail information +/// +/// 资源集分类(节点)详细信息 #[derive(Serialize, Deserialize, Debug)] #[cfg_attr(feature = "default", derive(poem_openapi::Object, sea_orm::FromQueryResult))] pub struct RbumSetCateDetailResp { + /// Node id + /// + /// 节点id pub id: String, + /// System (internal) code + /// + /// 系统(内部)编码 + /// + /// using regular hierarchical code to avoid recursive tree queries. + /// + /// 使用规则的层级编码,避免递归树查询。 pub sys_code: String, + /// Business code for custom + /// + /// 自定义业务编码 pub bus_code: String, + /// Node name + /// + /// 节点名称 pub name: String, + /// Node icon + /// + /// 节点图标 pub icon: String, + /// Node sort + /// + /// 节点排序 pub sort: i64, + /// Node extension information + /// + /// 节点扩展信息 pub ext: String, - + /// Associated [resource set](crate::rbum::dto::rbum_set_dto::RbumSetDetailResp) id + /// + /// 关联[资源集](crate::rbum::dto::rbum_set_dto::RbumSetDetailResp) id pub rel_rbum_set_id: String, pub own_paths: String, diff --git a/backend/basic/src/rbum/dto/rbum_set_dto.rs b/backend/basic/src/rbum/dto/rbum_set_dto.rs index 5c1e81d05..a7a7d8f7e 100644 --- a/backend/basic/src/rbum/dto/rbum_set_dto.rs +++ b/backend/basic/src/rbum/dto/rbum_set_dto.rs @@ -1,6 +1,6 @@ use crate::rbum::dto::rbum_domain_dto::RbumDomainSummaryResp; use crate::rbum::dto::rbum_kind_dto::RbumKindSummaryResp; -use crate::rbum::dto::rbum_set_item_dto::RbumSetItemInfoResp; +use crate::rbum::dto::rbum_set_item_dto::RbumSetItemRelInfoResp; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use tardis::basic::field::TrimString; @@ -12,20 +12,44 @@ use tardis::web::poem_openapi; use crate::rbum::rbum_enumeration::RbumScopeLevelKind; +/// Add request for resource set +/// +/// 资源集添加请求 #[derive(Serialize, Deserialize, Debug)] #[cfg_attr(feature = "default", derive(poem_openapi::Object))] pub struct RbumSetAddReq { + /// Resource set code + /// + /// 资源集编码 #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "255")))] pub code: TrimString, + /// Resource set kind + /// + /// 资源集类型 #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "255")))] pub kind: TrimString, + /// Resource set name + /// + /// 资源集名称 #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "255")))] pub name: TrimString, + /// Resource set note + /// + /// 资源集备注 #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "2000")))] pub note: Option, + /// Resource set icon + /// + /// 资源集图标 #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "1000")))] pub icon: Option, + /// Resource set sort + /// + /// 资源集排序 pub sort: Option, + /// Resource set extension information + /// + /// 资源集扩展信息 #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "1000")))] pub ext: Option, @@ -33,16 +57,34 @@ pub struct RbumSetAddReq { pub disabled: Option, } +/// Modify request for resource set +/// +/// 资源集修改请求 #[derive(Serialize, Deserialize, Debug)] #[cfg_attr(feature = "default", derive(poem_openapi::Object))] pub struct RbumSetModifyReq { + /// Resource set name + /// + /// 资源集名称 #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "255")))] pub name: Option, + /// Resource set note + /// + /// 资源集备注 #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "2000")))] pub note: Option, + /// Resource set icon + /// + /// 资源集图标 #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "1000")))] pub icon: Option, + /// Resource set sort + /// + /// 资源集排序 pub sort: Option, + /// Resource set extension information + /// + /// 资源集扩展信息 #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "1000")))] pub ext: Option, @@ -50,15 +92,39 @@ pub struct RbumSetModifyReq { pub disabled: Option, } +/// Resource set summary information +/// +/// 资源集概要信息 #[derive(Serialize, Deserialize, Debug)] #[cfg_attr(feature = "default", derive(poem_openapi::Object, sea_orm::FromQueryResult))] pub struct RbumSetSummaryResp { + /// Resource set id + /// + /// 资源集id pub id: String, + /// Resource set code + /// + /// 资源集编码 pub code: String, + /// Resource set kind + /// + /// 资源集类型 pub kind: String, + /// Resource set name + /// + /// 资源集名称 pub name: String, + /// Resource set icon + /// + /// 资源集图标 pub icon: String, + /// Resource set sort + /// + /// 资源集排序 pub sort: i64, + /// Resource set extension information + /// + /// 资源集扩展信息 pub ext: String, pub own_paths: String, @@ -70,16 +136,43 @@ pub struct RbumSetSummaryResp { pub disabled: bool, } +/// Resource set detail information +/// +/// 资源集详细信息 #[derive(Serialize, Deserialize, Debug)] #[cfg_attr(feature = "default", derive(poem_openapi::Object, sea_orm::FromQueryResult))] pub struct RbumSetDetailResp { + /// Resource set id + /// + /// 资源集id pub id: String, + /// Resource set code + /// + /// 资源集编码 pub code: String, + /// Resource set kind + /// + /// 资源集类型 pub kind: String, + /// Resource set name + /// + /// 资源集名称 pub name: String, + /// Resource set note + /// + /// 资源集备注 pub note: String, + /// Resource set icon + /// + /// 资源集图标 pub icon: String, + /// Resource set sort + /// + /// 资源集排序 pub sort: i64, + /// Resource set extension information + /// + /// 资源集扩展信息 pub ext: String, pub own_paths: String, @@ -92,51 +185,125 @@ pub struct RbumSetDetailResp { pub disabled: bool, } +/// Resource set path information +/// +/// 资源集路径信息 #[derive(Serialize, Deserialize, Debug)] #[cfg_attr(feature = "default", derive(poem_openapi::Object, sea_orm::FromQueryResult))] pub struct RbumSetPathResp { + /// Resource set id + /// + /// 资源集id pub id: String, + /// Resource set name + /// + /// 资源集名称 pub name: String, pub own_paths: String, } +/// Resource tree information +/// +/// 资源树信息 #[derive(Serialize, Deserialize, Debug, Clone)] #[cfg_attr(feature = "default", derive(poem_openapi::Object))] pub struct RbumSetTreeResp { - pub main: Vec, + /// Resource tree node information + /// + /// 资源树节点信息 + pub main: Vec, + /// Resource tree extension information + /// + /// 资源树扩展信息 pub ext: Option, } +/// Resource tree node information +/// +/// 资源树节点信息 #[derive(Serialize, Deserialize, Debug, Clone)] #[cfg_attr(feature = "default", derive(poem_openapi::Object))] -pub struct RbumSetTreeMainResp { +pub struct RbumSetTreeNodeResp { + /// Node id + /// + /// 节点id pub id: String, + /// System (internal) code + /// + /// 系统(内部)编码 + /// + /// using regular hierarchical code to avoid recursive tree queries. + /// + /// 使用规则的层级编码,避免递归树查询。 pub sys_code: String, + /// Business code for custom + /// + /// 自定义业务编码 pub bus_code: String, + /// Node name + /// + /// 节点名称 pub name: String, + /// Node icon + /// + /// 节点图标 pub icon: String, + /// Node sort + /// + /// 节点排序 pub sort: i64, + /// Node extension information + /// + /// 节点扩展信息 pub ext: String, + /// Parent node id + /// + /// 父节点Id + pub pid: Option, + /// Associated object id + /// + /// 关联对象Id + /// + /// This association is set by the business layer, and the rbum model will not assign a value to it. + /// + /// 此关联由上层的业务设置,rbum模型不会为其赋值。 + pub rel: Option, pub own_paths: String, pub owner: String, pub scope_level: RbumScopeLevelKind, - pub pid: Option, - //关联的tenant_id - pub rel: Option, } +/// Resource tree extension information +/// +/// 资源树扩展信息 #[derive(Serialize, Deserialize, Debug, Clone)] #[cfg_attr(feature = "default", derive(poem_openapi::Object))] pub struct RbumSetTreeExtResp { - // cate.id -> items - pub items: HashMap>, - // cate.id -> kind.id -> item number + /// 节点与资源项的关联信息 + /// + /// Node and resource item association information + /// + /// Format: ``node.id -> resource items`` + pub items: HashMap>, + /// 节点关联资源项统计信息 + /// + /// Node associated resource item statistics information + /// + /// Format: ``node.id -> [`crate::rbum::dto::rbum_set_item_dto::RbumSetItemInfoResp::rel_rbum_item_kind_id`] -> resource item number`` pub item_number_agg: HashMap>, - // kind.id -> kind info + /// Resource kind information + /// + /// 资源类型信息 + /// + /// Format: ``kind.id -> kind summary information`` pub item_kinds: HashMap, - // domain.id -> domain info + /// Resource domain information + /// + /// 资源域信息 + /// + /// Format: ``domain.id -> domain summary info`` pub item_domains: HashMap, } diff --git a/backend/basic/src/rbum/dto/rbum_set_item_dto.rs b/backend/basic/src/rbum/dto/rbum_set_item_dto.rs index 6e9f7dfee..5b0bbf368 100644 --- a/backend/basic/src/rbum/dto/rbum_set_item_dto.rs +++ b/backend/basic/src/rbum/dto/rbum_set_item_dto.rs @@ -7,35 +7,82 @@ use tardis::web::poem_openapi; use crate::rbum::rbum_enumeration::RbumScopeLevelKind; +/// Add request for association between resource set category(node) and resource item +/// +/// 添加资源集分类(节点)挂载资源项的关联的请求 #[derive(Serialize, Deserialize, Debug)] #[cfg_attr(feature = "default", derive(poem_openapi::Object))] pub struct RbumSetItemAddReq { + /// Association sort + /// + /// 关联排序 pub sort: i64, - + /// Associated [resource set](crate::rbum::dto::rbum_set_dto::RbumSetDetailResp) id + /// + /// 关联[资源集](crate::rbum::dto::rbum_set_dto::RbumSetDetailResp) id #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "255")))] pub rel_rbum_set_id: String, + /// Associated [resource set category(node)](crate::rbum::dto::rbum_set_cate_dto::RbumSetCateDetailResp) id + /// + /// 关联[资源集分类(节点)](crate::rbum::dto::rbum_set_cate_dto::RbumSetCateDetailResp) id #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "255")))] pub rel_rbum_set_cate_id: String, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) id + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) id #[cfg_attr(feature = "default", oai(validator(min_length = "2", max_length = "255")))] pub rel_rbum_item_id: String, } +/// Modify request for association between resource set category(node) and resource item +/// +/// 修改资源集分类(节点)挂载资源项的关联的请求 #[derive(Serialize, Deserialize, Debug)] #[cfg_attr(feature = "default", derive(poem_openapi::Object))] pub struct RbumSetItemModifyReq { + /// Association sort + /// + /// 关联排序 pub sort: i64, } +/// Summary information of the association between resource set category(node) and resource item +/// +/// 资源集分类(节点)挂载资源项的关联的概要信息 #[derive(Serialize, Deserialize, Debug)] #[cfg_attr(feature = "default", derive(poem_openapi::Object, sea_orm::FromQueryResult))] pub struct RbumSetItemSummaryResp { + /// Association id + /// + /// 关联id pub id: String, + /// Association sort + /// + /// 关联排序 pub sort: i64, + /// Associated [resource set](crate::rbum::dto::rbum_set_dto::RbumSetDetailResp) id + /// + /// 关联[资源集](crate::rbum::dto::rbum_set_dto::RbumSetDetailResp) id pub rel_rbum_set_id: String, + /// Associated [resource set category(node)](crate::rbum::dto::rbum_set_cate_dto::RbumSetCateDetailResp) id + /// + /// 关联[资源集分类(节点)](crate::rbum::dto::rbum_set_cate_dto::RbumSetCateDetailResp) id pub rel_rbum_set_cate_id: String, + /// Associated [resource set category(node)](crate::rbum::dto::rbum_set_cate_dto::RbumSetCateDetailResp) sys_code + /// + /// 关联[资源集分类(节点)](crate::rbum::dto::rbum_set_cate_dto::RbumSetCateDetailResp) sys_code pub rel_rbum_set_cate_sys_code: String, + /// Associated [resource set category(node)](crate::rbum::dto::rbum_set_cate_dto::RbumSetCateDetailResp) name + /// + /// 关联[资源集分类(节点)](crate::rbum::dto::rbum_set_cate_dto::RbumSetCateDetailResp) name pub rel_rbum_set_cate_name: String, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) id + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) id pub rel_rbum_item_id: String, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) name + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) name pub rel_rbum_item_name: String, pub own_paths: String, @@ -44,49 +91,139 @@ pub struct RbumSetItemSummaryResp { pub update_time: DateTime, } -#[derive(Serialize, Deserialize, Debug)] +/// Resource item information of the association between resource set category(node) and resource item +/// +/// 资源集分类(节点)挂载资源项的关联的资源项信息 +#[derive(Serialize, Deserialize, Debug, Clone)] #[cfg_attr(feature = "default", derive(poem_openapi::Object, sea_orm::FromQueryResult))] -pub struct RbumSetItemDetailResp { +pub struct RbumSetItemRelInfoResp { + /// Association id + /// + /// 关联id pub id: String, + /// Association sort + /// + /// 关联排序 pub sort: i64, - pub rel_rbum_set_id: String, - pub rel_rbum_set_cate_id: Option, - pub rel_rbum_set_cate_sys_code: Option, - pub rel_rbum_set_cate_name: Option, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) id + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) id pub rel_rbum_item_id: String, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) code + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) code pub rel_rbum_item_code: String, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) name + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) name pub rel_rbum_item_name: String, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) rel_rbum_kind_id + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) rel_rbum_kind_id pub rel_rbum_item_kind_id: String, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) rel_rbum_domain_id + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) rel_rbum_domain_id pub rel_rbum_item_domain_id: String, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) owner + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) owner pub rel_rbum_item_owner: String, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) create_time + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) create_time pub rel_rbum_item_create_time: DateTime, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) update_time + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) update_time pub rel_rbum_item_update_time: DateTime, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) disabled + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) disabled pub rel_rbum_item_disabled: bool, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) scope_level + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) scope_level pub rel_rbum_item_scope_level: RbumScopeLevelKind, pub own_paths: String, pub owner: String, - pub owner_name: Option, - pub create_time: DateTime, - pub update_time: DateTime, } -#[derive(Serialize, Deserialize, Debug, Clone)] +/// Detail information of the association between resource set category(node) and resource item +/// +/// 资源集分类(节点)挂载资源项的关联的详细信息 +#[derive(Serialize, Deserialize, Debug)] #[cfg_attr(feature = "default", derive(poem_openapi::Object, sea_orm::FromQueryResult))] -pub struct RbumSetItemInfoResp { +pub struct RbumSetItemDetailResp { + /// Association id + /// + /// 关联id pub id: String, + /// Association sort + /// + /// 关联排序 pub sort: i64, + /// Associated [resource set](crate::rbum::dto::rbum_set_dto::RbumSetDetailResp) id + /// + /// 关联[资源集](crate::rbum::dto::rbum_set_dto::RbumSetDetailResp) id + pub rel_rbum_set_id: String, + /// Associated [resource set category(node)](crate::rbum::dto::rbum_set_cate_dto::RbumSetCateDetailResp) id + /// + /// 关联[资源集分类(节点)](crate::rbum::dto::rbum_set_cate_dto::RbumSetCateDetailResp) id + pub rel_rbum_set_cate_id: Option, + /// Associated [resource set category(node)](crate::rbum::dto::rbum_set_cate_dto::RbumSetCateDetailResp) sys_code + /// + /// 关联[资源集分类(节点)](crate::rbum::dto::rbum_set_cate_dto::RbumSetCateDetailResp) sys_code + pub rel_rbum_set_cate_sys_code: Option, + /// Associated [resource set category(node)](crate::rbum::dto::rbum_set_cate_dto::RbumSetCateDetailResp) name + /// + /// 关联[资源集分类(节点)](crate::rbum::dto::rbum_set_cate_dto::RbumSetCateDetailResp) name + pub rel_rbum_set_cate_name: Option, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) id + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) id pub rel_rbum_item_id: String, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) code + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) code pub rel_rbum_item_code: String, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) name + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) name pub rel_rbum_item_name: String, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) rel_rbum_kind_id + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) rel_rbum_kind_id pub rel_rbum_item_kind_id: String, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) rel_rbum_domain_id + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) rel_rbum_domain_id pub rel_rbum_item_domain_id: String, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) owner + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) owner pub rel_rbum_item_owner: String, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) create_time + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) create_time pub rel_rbum_item_create_time: DateTime, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) update_time + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) update_time pub rel_rbum_item_update_time: DateTime, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) disabled + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) disabled pub rel_rbum_item_disabled: bool, + /// Associated [resource item](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) scope_level + /// + /// 关联[资源项](crate::rbum::dto::rbum_item_dto::RbumItemDetailResp) scope_level pub rel_rbum_item_scope_level: RbumScopeLevelKind, pub own_paths: String, pub owner: String, + pub owner_name: Option, + pub create_time: DateTime, + pub update_time: DateTime, } diff --git a/backend/basic/src/rbum/rbum_config.rs b/backend/basic/src/rbum/rbum_config.rs index f0bb58bfa..02b417f2c 100644 --- a/backend/basic/src/rbum/rbum_config.rs +++ b/backend/basic/src/rbum/rbum_config.rs @@ -3,30 +3,74 @@ use std::fmt::Debug; use std::sync::Mutex; use lazy_static::lazy_static; -use serde::{Deserialize, Serialize}; +use serde::{de, Deserialize, Serialize}; use tardis::basic::error::TardisError; use tardis::basic::result::TardisResult; use tardis::TardisFunsInst; +/// Rbum configuration +/// +/// Rbum 配置 #[derive(Debug, Serialize, Deserialize, Clone)] #[serde(default)] pub struct RbumConfig { + /// The length of the system code of the set category(node) + /// + /// 集合分类(节点)系统代码的长度 pub set_cate_sys_code_node_len: usize, + /// The topic of the message queue when the entity is deleted + /// + /// 实体删除时的消息队列主题 + /// + /// TODO + #[deprecated] pub mq_topic_entity_deleted: String, + /// The topic of the message queue when the event occurs + /// + /// 事件发生时的消息队列主题 pub mq_topic_event: String, + #[deprecated] pub mq_header_name_operator: String, + #[deprecated] pub task_mq_topic_event: String, - // own_paths:ak -> vcode - pub cache_key_cert_vcode_info_: String, - // set_code -> set_id + /// Cache key prefix for resource set code + /// + /// 资源集合代码的缓存键前缀 + /// + /// Format: ``set_code -> set_id`` pub cache_key_set_code_: String, + /// Cache key expiration time for resource set code + /// + /// 资源集合代码的缓存键过期时间 pub cache_key_set_code_expire_sec: usize, - // rbum_item_id -> nil expired + /// Cache key prefix for certificate verification code information + /// + /// 凭证验证码信息的缓存键前缀 + /// + /// Format: ``own_paths:ak -> vcode`` + pub cache_key_cert_vcode_info_: String, + /// Cache key prefix for locked certificate + /// + /// 锁定凭证的缓存键前缀 + /// + /// Format: ``rbum_item_id -> nil`` pub cache_key_cert_locked_: String, - // rbum_item_id -> error times by cycle + /// Cache key prefix for certificate error times + /// + /// 凭证错误次数的缓存键前缀 + /// + /// Format: ``rbum_item_id -> error times by cycle`` pub cache_key_cert_err_times_: String, - // table name (supports prefix matching) -> + /// Event domain configuration + /// + /// 事件域配置 + /// + /// Format: ``table name (supports prefix matching) -> `` + /// TODO pub event_domains: HashMap, + /// Header name of BIOS context request + /// + /// BIOS 上下文的请求头名称 pub head_key_bios_ctx: String, } @@ -76,6 +120,7 @@ impl RbumConfigManager { } } +// TODO simplify pub trait RbumConfigApi { fn rbum_conf_set_cate_sys_code_node_len(&self) -> usize; fn rbum_conf_mq_topic_entity_deleted(&self) -> String; diff --git a/backend/basic/src/rbum/rbum_enumeration.rs b/backend/basic/src/rbum/rbum_enumeration.rs index 1dc9f54c8..183bd227f 100644 --- a/backend/basic/src/rbum/rbum_enumeration.rs +++ b/backend/basic/src/rbum/rbum_enumeration.rs @@ -11,13 +11,43 @@ use tardis::derive_more::Display; #[cfg(feature = "default")] use tardis::web::poem_openapi; +/// Scope level kind +/// +/// 作用域层级类型 #[derive(Display, Clone, Debug, PartialEq, Eq, Serialize)] #[cfg_attr(feature = "default", derive(poem_openapi::Enum))] pub enum RbumScopeLevelKind { + /// Private + /// + /// 私有 + /// + /// Only the current level is visible. + /// + /// 仅当前层级可见。 Private, + /// (全局)完全公开 + /// + /// (Global)Fully open Root, + /// The first level + /// + /// 第一层 + /// + /// The current level and its descendants are visible. + /// + /// 当前层及其子孙层可见。 L1, + /// The second level + /// + /// 第二层 + /// + /// The current level and its descendants are visible. L2, + /// The third level + /// + /// 第三层 + /// + /// The current level and its descendants are visible. L3, } @@ -72,11 +102,24 @@ impl TryGetable for RbumScopeLevelKind { } } +/// Certificate relationship kind +/// +/// +/// 凭证关联的类型 #[derive(Display, Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] #[cfg_attr(feature = "default", derive(poem_openapi::Enum))] pub enum RbumCertRelKind { + /// Resource item + /// + /// 资源项 Item, + /// Resource set + /// + /// 资源集 Set, + /// Resource relation + /// + /// 资源关联 Rel, } @@ -111,51 +154,19 @@ impl TryGetable for RbumCertRelKind { } } -#[derive(Display, Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[cfg_attr(feature = "default", derive(poem_openapi::Enum))] -pub enum RbumRelFromKind { - Item, - Set, - SetCate, - Cert, -} - -impl RbumRelFromKind { - pub fn from_int(s: i16) -> TardisResult { - match s { - 0 => Ok(RbumRelFromKind::Item), - 1 => Ok(RbumRelFromKind::Set), - 2 => Ok(RbumRelFromKind::SetCate), - 3 => Ok(RbumRelFromKind::Cert), - _ => Err(TardisError::format_error(&format!("invalid RbumRelFromKind: {s}"), "406-rbum-*-enum-init-error")), - } - } - - pub fn to_int(&self) -> i16 { - match self { - RbumRelFromKind::Item => 0, - RbumRelFromKind::Set => 1, - RbumRelFromKind::SetCate => 2, - RbumRelFromKind::Cert => 3, - } - } -} - -#[cfg(feature = "default")] -impl TryGetable for RbumRelFromKind { - fn try_get(res: &QueryResult, pre: &str, col: &str) -> Result { - let s = i16::try_get(res, pre, col)?; - RbumRelFromKind::from_int(s).map_err(|_| TryGetError::DbErr(DbErr::RecordNotFound(format!("{pre}:{col}")))) - } - - fn try_get_by(_res: &QueryResult, _index: I) -> Result { - panic!("not implemented") - } -} +/// Resource certificate configuration status kind +/// +/// 资源凭证配置状态类型 #[derive(Display, Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] #[cfg_attr(feature = "default", derive(poem_openapi::Enum))] pub enum RbumCertConfStatusKind { + /// Disabled + /// + /// 禁用 Disabled, + /// Enabled + /// + /// 启用 Enabled, } @@ -175,11 +186,24 @@ impl RbumCertConfStatusKind { } } } + +/// Resource certificate status kind +/// +/// 资源凭证状态类型 #[derive(Display, Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] #[cfg_attr(feature = "default", derive(poem_openapi::Enum))] pub enum RbumCertStatusKind { + /// Disabled + /// + /// 禁用 Disabled, + /// Enabled + /// + /// 启用 Enabled, + /// Pending + /// + /// 正在处理 Pending, } @@ -214,13 +238,92 @@ impl TryGetable for RbumCertStatusKind { } } +/// Resource relation kind +/// +/// 资源关联的类型 +#[derive(Display, Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] +#[cfg_attr(feature = "default", derive(poem_openapi::Enum))] +pub enum RbumRelFromKind { + /// Resource item + /// + /// 资源项 + Item, + /// Resource set + /// + /// 资源集 + Set, + /// Resource set category(node) + /// + /// 资源集分类(节点) + SetCate, + /// Resource certificate + /// + /// 资源凭证 + Cert, +} + +impl RbumRelFromKind { + pub fn from_int(s: i16) -> TardisResult { + match s { + 0 => Ok(RbumRelFromKind::Item), + 1 => Ok(RbumRelFromKind::Set), + 2 => Ok(RbumRelFromKind::SetCate), + 3 => Ok(RbumRelFromKind::Cert), + _ => Err(TardisError::format_error(&format!("invalid RbumRelFromKind: {s}"), "406-rbum-*-enum-init-error")), + } + } + + pub fn to_int(&self) -> i16 { + match self { + RbumRelFromKind::Item => 0, + RbumRelFromKind::Set => 1, + RbumRelFromKind::SetCate => 2, + RbumRelFromKind::Cert => 3, + } + } +} + +#[cfg(feature = "default")] +impl TryGetable for RbumRelFromKind { + fn try_get(res: &QueryResult, pre: &str, col: &str) -> Result { + let s = i16::try_get(res, pre, col)?; + RbumRelFromKind::from_int(s).map_err(|_| TryGetError::DbErr(DbErr::RecordNotFound(format!("{pre}:{col}")))) + } + + fn try_get_by(_res: &QueryResult, _index: I) -> Result { + panic!("not implemented") + } +} + +/// Resource relation environment kind +/// +/// 资源关联环境类型 +/// +/// Used to associate resources with restrictions. +/// +/// 用于给资源关联加上限制条件。 #[derive(Display, Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] #[cfg_attr(feature = "default", derive(poem_openapi::Enum))] pub enum RbumRelEnvKind { + /// Datetime range + /// + /// 日期时间范围 DatetimeRange, + /// Time range + /// + /// 时间范围 TimeRange, + /// IP list + /// + /// IP地址 Ips, + /// Call frequency + /// + /// 调用频率 CallFrequency, + /// Call count + /// + /// 调用次数 CallCount, } @@ -259,6 +362,37 @@ impl TryGetable for RbumRelEnvKind { } } +/// Resource set category(node) query kind +/// +/// 资源集分类(节点)的查询类型 +#[derive(Display, Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] +#[cfg_attr(feature = "default", derive(poem_openapi::Enum))] +pub enum RbumSetCateLevelQueryKind { + /// Current layer and descendant layer + /// + /// 当前层及子孙层 + CurrentAndSub, + /// Current layer and grandfather layer + /// + /// 当前层及祖父层 + CurrentAndParent, + /// Descendant layer + /// + /// 子孙层 + Sub, + /// Grandfather layer + /// + /// 祖父层 + Parent, + /// Current layer only + /// + /// 仅当前层 + Current, +} + +/// Data kind +/// +/// 数据类型 #[derive(Display, Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] #[cfg_attr(feature = "default", derive(poem_openapi::Enum, strum::EnumString))] pub enum RbumDataTypeKind { @@ -289,6 +423,9 @@ impl TryGetable for RbumDataTypeKind { } } +/// Widget kind +/// +/// (前端)控件类型 #[derive(Display, Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] #[cfg_attr(feature = "default", derive(poem_openapi::Enum, strum::EnumString))] pub enum RbumWidgetTypeKind { @@ -308,9 +445,18 @@ pub enum RbumWidgetTypeKind { MultiSelect, Link, CodeEditor, - Container, // Display group subtitles, datatype = String, value is empty - Control, // Json fields : all parent_attr_name = current attribute, datatype = Json - Group, // Sub fields : all parent_attr_name = current attribute, datatype = Array, The value of the json array is stored to the current field. + /// Display group subtitles, ``datatype = String & value is empty`` + /// + /// 显示组标题,``datatype = String & 值为空`` + Container, + /// Json fields : ``datatype = Json && all parent_attr_name = current attribute`` + /// + /// Json字段,``datatype = Json && 所有 parent_attr_name = 当前属性`` + Control, + /// Sub fields : ``datatype = Array && all parent_attr_name = current attribute``, The value of the json array is stored to the current field. + /// + /// 子字段,``datatype = Array && 所有 parent_attr_name = 当前属性``,将json数组的值存储到当前字段。 + Group, } #[cfg(feature = "default")] @@ -324,13 +470,3 @@ impl TryGetable for RbumWidgetTypeKind { panic!("not implemented") } } - -#[derive(Display, Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -#[cfg_attr(feature = "default", derive(poem_openapi::Enum))] -pub enum RbumSetCateLevelQueryKind { - CurrentAndSub, - CurrentAndParent, - Sub, - Parent, - Current, -} diff --git a/backend/basic/src/rbum/serv/rbum_set_serv.rs b/backend/basic/src/rbum/serv/rbum_set_serv.rs index ecf5359ff..dd14d12cc 100644 --- a/backend/basic/src/rbum/serv/rbum_set_serv.rs +++ b/backend/basic/src/rbum/serv/rbum_set_serv.rs @@ -15,9 +15,9 @@ use crate::rbum::domain::{rbum_cert, rbum_item, rbum_rel, rbum_set, rbum_set_cat use crate::rbum::dto::rbum_filer_dto::{RbumBasicFilterReq, RbumKindFilterReq, RbumSetCateFilterReq, RbumSetFilterReq, RbumSetItemFilterReq, RbumSetTreeFilterReq}; use crate::rbum::dto::rbum_set_cate_dto::{RbumSetCateAddReq, RbumSetCateDetailResp, RbumSetCateModifyReq, RbumSetCateSummaryResp}; use crate::rbum::dto::rbum_set_dto::{ - RbumSetAddReq, RbumSetDetailResp, RbumSetModifyReq, RbumSetPathResp, RbumSetSummaryResp, RbumSetTreeExtResp, RbumSetTreeMainResp, RbumSetTreeResp, + RbumSetAddReq, RbumSetDetailResp, RbumSetModifyReq, RbumSetPathResp, RbumSetSummaryResp, RbumSetTreeExtResp, RbumSetTreeNodeResp, RbumSetTreeResp, }; -use crate::rbum::dto::rbum_set_item_dto::{RbumSetItemAddReq, RbumSetItemDetailResp, RbumSetItemInfoResp, RbumSetItemModifyReq, RbumSetItemSummaryResp}; +use crate::rbum::dto::rbum_set_item_dto::{RbumSetItemAddReq, RbumSetItemDetailResp, RbumSetItemModifyReq, RbumSetItemRelInfoResp, RbumSetItemSummaryResp}; use crate::rbum::rbum_config::RbumConfigApi; use crate::rbum::rbum_enumeration::{RbumCertRelKind, RbumRelFromKind, RbumScopeLevelKind, RbumSetCateLevelQueryKind}; use crate::rbum::serv::rbum_cert_serv::RbumCertServ; @@ -86,6 +86,9 @@ impl RbumCrudOperation TardisResult> { Self::check_ownership(id, funs, ctx).await?; + // Cannot be deleted when there are categories (nodes), associated resource items, associated relationships, and associated resource credentials. + // + // 存在分类(节点)、关联资源项、关联关系、关联资源凭证时不能删除。 Self::check_exist_before_delete(id, RbumSetCateServ::get_table_name(), rbum_set_cate::Column::RelRbumSetId.as_str(), funs).await?; Self::check_exist_before_delete(id, RbumSetItemServ::get_table_name(), rbum_set_item::Column::RelRbumSetId.as_str(), funs).await?; Self::check_exist_with_cond_before_delete( @@ -102,6 +105,7 @@ impl RbumCrudOperation = sys_codes.iter().filter(|sys_code| !sys_code.is_empty()).map(|sys_code| sys_code.to_string()).collect(); if !sys_code_vec.is_empty() { - values.insert("sys_code".to_string(), &sys_code_vec); + let tmp_set_ids = vec![rbum_set_id.to_string()]; + let values = HashMap::from([("rel_rbum_set_id".to_string(), &tmp_set_ids), ("sys_code".to_string(), &sys_code_vec)]); Self::check_scopes(values, sys_code_vec.len() as u64, RbumSetCateServ::get_table_name(), funs, ctx).await?; } } @@ -215,7 +213,7 @@ impl RbumSetServ { resp.sort_by(|a, b| a.sort.cmp(&b.sort)); let mut tree_main = resp .iter() - .map(|r| RbumSetTreeMainResp { + .map(|r| RbumSetTreeNodeResp { id: r.id.to_string(), sys_code: r.sys_code.to_string(), bus_code: r.bus_code.to_string(), @@ -249,7 +247,7 @@ impl RbumSetServ { ..Default::default() }, rel_rbum_set_id: Some(rbum_set_id.to_string()), - table_rbum_set_cate_is_left: Some(true), + rel_rbum_item_can_not_exist: Some(true), sys_code_query_kind: filter.sys_code_query_kind.clone(), sys_code_query_depth: filter.sys_code_query_depth, rel_rbum_set_cate_sys_codes: filter.sys_codes.clone(), @@ -278,7 +276,7 @@ impl RbumSetServ { rbum_set_items .iter() .filter(|i| i.rel_rbum_set_cate_id.clone().unwrap_or_default() == cate.id) - .map(|i| RbumSetItemInfoResp { + .map(|i| RbumSetItemRelInfoResp { id: i.id.to_string(), sort: i.sort, rel_rbum_item_id: i.rel_rbum_item_id.to_string(), @@ -297,13 +295,13 @@ impl RbumSetServ { .collect(), ) }) - .collect::>>(); + .collect::>>(); items.insert( "".to_string(), rbum_set_items .iter() .filter(|i| i.rel_rbum_set_cate_id.is_none()) - .map(|i| RbumSetItemInfoResp { + .map(|i| RbumSetItemRelInfoResp { id: i.id.to_string(), sort: i.sort, rel_rbum_item_id: i.rel_rbum_item_id.to_string(), @@ -371,7 +369,7 @@ impl RbumSetServ { }) } - fn filter_exist_items(tree_main: &Vec, cate_id: &str, rbum_set_items: &Vec) -> Vec { + fn filter_exist_items(tree_main: &Vec, cate_id: &str, rbum_set_items: &Vec) -> Vec { let mut sub_cates = tree_main .iter() .filter(|cate| cate.pid == Some(cate_id.to_string())) @@ -835,7 +833,7 @@ impl RbumCrudOperation TardisResult { let rel_item_table = Alias::new("relItem"); - let rbum_set_cate_join_type = if let Some(true) = filter.table_rbum_set_cate_is_left { + let rbum_set_cate_join_type = if let Some(true) = filter.rel_rbum_item_can_not_exist { JoinType::LeftJoin } else { JoinType::InnerJoin diff --git a/backend/supports/iam/src/basic/dto/iam_set_dto.rs b/backend/supports/iam/src/basic/dto/iam_set_dto.rs index 638f27319..c14e13f56 100644 --- a/backend/supports/iam/src/basic/dto/iam_set_dto.rs +++ b/backend/supports/iam/src/basic/dto/iam_set_dto.rs @@ -1,4 +1,4 @@ -use bios_basic::rbum::dto::rbum_set_dto::{RbumSetTreeExtResp, RbumSetTreeMainResp}; +use bios_basic::rbum::dto::rbum_set_dto::{RbumSetTreeExtResp, RbumSetTreeNodeResp}; use serde::{Deserialize, Serialize}; use tardis::basic::field::TrimString; use tardis::web::poem_openapi; @@ -66,7 +66,7 @@ pub struct IamSetItemAddReq { #[derive(Serialize, Deserialize, Debug, Clone)] #[cfg_attr(feature = "default", derive(poem_openapi::Object))] pub struct IamSetTreeResp { - pub main: Vec, + pub main: Vec, pub ext: Option, pub rel: Option, } diff --git a/backend/supports/iam/src/basic/serv/iam_set_serv.rs b/backend/supports/iam/src/basic/serv/iam_set_serv.rs index 15d8adf5c..6ee2a220b 100644 --- a/backend/supports/iam/src/basic/serv/iam_set_serv.rs +++ b/backend/supports/iam/src/basic/serv/iam_set_serv.rs @@ -3,7 +3,7 @@ use std::collections::{HashMap, HashSet}; use bios_basic::rbum::dto::rbum_filer_dto::{RbumBasicFilterReq, RbumRelFilterReq, RbumSetCateFilterReq, RbumSetFilterReq, RbumSetItemFilterReq, RbumSetTreeFilterReq}; use bios_basic::rbum::dto::rbum_set_cate_dto::{RbumSetCateAddReq, RbumSetCateModifyReq, RbumSetCateSummaryResp}; -use bios_basic::rbum::dto::rbum_set_dto::{RbumSetAddReq, RbumSetPathResp, RbumSetTreeMainResp, RbumSetTreeResp}; +use bios_basic::rbum::dto::rbum_set_dto::{RbumSetAddReq, RbumSetPathResp, RbumSetTreeNodeResp, RbumSetTreeResp}; use bios_basic::rbum::dto::rbum_set_item_dto::{RbumSetItemAddReq, RbumSetItemDetailResp, RbumSetItemModifyReq}; use bios_basic::rbum::helper::rbum_scope_helper; use bios_basic::rbum::rbum_config::RbumConfigApi; @@ -371,7 +371,7 @@ impl IamSetServ { // find set_cate 对应的set_id,返回set_id下面set_cate // 返回的节点里面,如果有通过关联关系而来的cate(不属于此set_id的),会在ext中标识它真正的set_id async fn find_rel_set_cate(resp: RbumSetTreeResp, filter: &mut RbumSetTreeFilterReq, funs: &TardisFunsInst, ctx: &TardisContext) -> TardisResult { - let mut result_main: Vec = vec![]; + let mut result_main: Vec = vec![]; let mut resp_items = HashMap::new(); let mut resp_item_domains = HashMap::new(); let mut resp_item_kinds = HashMap::new(); @@ -396,7 +396,7 @@ impl IamSetServ { ) .await? { - let new_resp = RbumSetTreeMainResp { + let new_resp = RbumSetTreeNodeResp { rel: Some(set_rel.to_rbum_item_id.clone()), ..r.clone() }; @@ -418,12 +418,12 @@ impl IamSetServ { } let rel_set_id = IamSetServ::get_default_set_id_by_ctx(&IamSetKind::Org, funs, &mock_ctx).await?; let mut tenant_resp = RbumSetServ::get_tree(&rel_set_id, &set_filter, funs, &mock_ctx).await?; - let mut resp_tenant_node: Vec = tenant_resp + let mut resp_tenant_node: Vec = tenant_resp .main .clone() .iter() .filter(|r_main| r_main.pid.is_none()) - .map(|r_main| RbumSetTreeMainResp { + .map(|r_main| RbumSetTreeNodeResp { pid: Some(r.id.clone()), ..r_main.clone() }) @@ -438,7 +438,7 @@ impl IamSetServ { r.ext = json!({"set_id":rel_set_id.clone(),"disable_import":true}).to_string(); r }) - .collect::>(), + .collect::>(), ); if set_filter.fetch_cate_item { if let Some(ext_resp) = tenant_resp.ext { @@ -635,7 +635,7 @@ impl IamSetServ { &RbumSetItemFilterReq { basic: Default::default(), rel_rbum_item_disabled: Some(false), - table_rbum_set_cate_is_left: Some(true), + rel_rbum_item_can_not_exist: Some(true), ..Default::default() }, funs, @@ -696,7 +696,7 @@ impl IamSetServ { with_sub_own_paths: with_sub, ..Default::default() }, - table_rbum_set_cate_is_left, + rel_rbum_item_can_not_exist: table_rbum_set_cate_is_left, rel_rbum_item_disabled: Some(false), rel_rbum_set_id: set_id.clone(), rel_rbum_set_cate_ids: set_cate_id.map(|r| vec![r]), @@ -730,7 +730,7 @@ impl IamSetServ { rel_rbum_item_disabled: Some(false), rel_rbum_set_id: set_id.clone(), rel_rbum_set_item_cate_code: Some("".to_string()), - table_rbum_set_cate_is_left: Some(true), + rel_rbum_item_can_not_exist: Some(true), rel_rbum_item_ids: item_id.map(|i| vec![i]), ..Default::default() }, diff --git a/backend/supports/iam/src/console_interface/api/iam_ci_account_api.rs b/backend/supports/iam/src/console_interface/api/iam_ci_account_api.rs index 33616285a..18076f82d 100644 --- a/backend/supports/iam/src/console_interface/api/iam_ci_account_api.rs +++ b/backend/supports/iam/src/console_interface/api/iam_ci_account_api.rs @@ -252,7 +252,7 @@ impl IamCiAccountApi { ..Default::default() }, rel_rbum_item_disabled: Some(false), - table_rbum_set_cate_is_left: Some(true), + rel_rbum_item_can_not_exist: Some(true), rel_rbum_set_id: Some(set_id.clone()), rel_rbum_item_ids: Some(vec![ctx.owner.clone()]), ..Default::default() @@ -276,7 +276,7 @@ impl IamCiAccountApi { ..Default::default() }, rel_rbum_item_disabled: Some(false), - table_rbum_set_cate_is_left: Some(true), + rel_rbum_item_can_not_exist: Some(true), rel_rbum_set_id: Some(set_id.clone()), rel_rbum_set_cate_sys_codes: Some(cate_codes), sys_code_query_kind: Some(RbumSetCateLevelQueryKind::CurrentAndSub), @@ -320,7 +320,7 @@ impl IamCiAccountApi { ..Default::default() }, rel_rbum_item_disabled: Some(false), - table_rbum_set_cate_is_left: Some(true), + rel_rbum_item_can_not_exist: Some(true), rel_rbum_set_id: Some(set_id.clone()), rel_rbum_set_cate_sys_codes: cate_sys_codes.0.map(|codes| codes.split(',').map(|code| code.to_string()).collect::>()), sys_code_query_kind: sys_code_query_kind.0, diff --git a/backend/supports/iam/src/console_interface/api/iam_ci_app_api.rs b/backend/supports/iam/src/console_interface/api/iam_ci_app_api.rs index 9a61e06b4..6821e7201 100644 --- a/backend/supports/iam/src/console_interface/api/iam_ci_app_api.rs +++ b/backend/supports/iam/src/console_interface/api/iam_ci_app_api.rs @@ -89,7 +89,7 @@ impl IamCiAppApi { ..Default::default() }, rel_rbum_item_disabled: Some(false), - table_rbum_set_cate_is_left: Some(true), + rel_rbum_item_can_not_exist: Some(true), rel_rbum_set_id: Some(set_id.clone()), rel_rbum_item_ids: Some(vec![ctx.owner.clone()]), ..Default::default() @@ -113,7 +113,7 @@ impl IamCiAppApi { ..Default::default() }, rel_rbum_item_disabled: Some(false), - table_rbum_set_cate_is_left: Some(true), + rel_rbum_item_can_not_exist: Some(true), rel_rbum_set_id: Some(set_id.clone()), rel_rbum_set_cate_sys_codes: Some(cate_codes), sys_code_query_kind: Some(RbumSetCateLevelQueryKind::CurrentAndSub), @@ -157,7 +157,7 @@ impl IamCiAppApi { ..Default::default() }, rel_rbum_item_disabled: Some(false), - table_rbum_set_cate_is_left: Some(true), + rel_rbum_item_can_not_exist: Some(true), rel_rbum_set_id: Some(set_id.clone()), rel_rbum_set_cate_sys_codes: cate_sys_codes.0.map(|codes| codes.split(',').map(|code| code.to_string()).collect::>()), sys_code_query_kind: sys_code_query_kind.0, diff --git a/backend/supports/iam/src/console_interface/api/iam_ci_app_set_api.rs b/backend/supports/iam/src/console_interface/api/iam_ci_app_set_api.rs index b858bc58f..8af9c166d 100644 --- a/backend/supports/iam/src/console_interface/api/iam_ci_app_set_api.rs +++ b/backend/supports/iam/src/console_interface/api/iam_ci_app_set_api.rs @@ -44,7 +44,7 @@ impl IamCiAppSetApi { ..Default::default() }, rel_rbum_item_disabled: Some(false), - table_rbum_set_cate_is_left: Some(true), + rel_rbum_item_can_not_exist: Some(true), rel_rbum_set_id: Some(set_id.clone()), rel_rbum_set_cate_ids: cate_ids.0.map(|ids| ids.split(',').map(|id| id.to_string()).collect::>()), rel_rbum_item_ids: item_ids.0.map(|ids| ids.split(',').map(|id| id.to_string()).collect::>()), diff --git a/backend/supports/iam/src/console_interface/api/iam_ci_tenant_api.rs b/backend/supports/iam/src/console_interface/api/iam_ci_tenant_api.rs index 15f103036..18fc3d12e 100644 --- a/backend/supports/iam/src/console_interface/api/iam_ci_tenant_api.rs +++ b/backend/supports/iam/src/console_interface/api/iam_ci_tenant_api.rs @@ -1,6 +1,6 @@ use bios_basic::helper::request_helper::try_set_real_ip_from_req_to_ctx; use bios_basic::rbum::dto::rbum_filer_dto::RbumSetTreeFilterReq; -use bios_basic::rbum::dto::rbum_set_dto::RbumSetTreeMainResp; +use bios_basic::rbum::dto::rbum_set_dto::RbumSetTreeNodeResp; use bios_basic::rbum::helper::rbum_scope_helper::check_without_owner_and_unsafe_fill_ctx; use bios_basic::rbum::rbum_enumeration::RbumSetCateLevelQueryKind; @@ -58,7 +58,7 @@ impl IamCiTenantApi { set_id: Query>, mut ctx: TardisContextExtractor, request: &Request, - ) -> TardisApiResult> { + ) -> TardisApiResult> { let funs = iam_constants::get_tardis_inst(); check_without_owner_and_unsafe_fill_ctx(request, &funs, &mut ctx.0)?; let ctx = IamSetServ::try_get_rel_ctx_by_set_id(set_id.0, &funs, ctx.0).await?; diff --git a/backend/supports/iam/src/console_passport/api/iam_cp_account_api.rs b/backend/supports/iam/src/console_passport/api/iam_cp_account_api.rs index d2c9bf86a..ab7678b40 100644 --- a/backend/supports/iam/src/console_passport/api/iam_cp_account_api.rs +++ b/backend/supports/iam/src/console_passport/api/iam_cp_account_api.rs @@ -79,7 +79,7 @@ impl IamCpAccountApi { ..Default::default() }, rel_rbum_item_disabled: Some(false), - table_rbum_set_cate_is_left: Some(true), + rel_rbum_item_can_not_exist: Some(true), rel_rbum_set_id: Some(set_id.clone()), rel_rbum_item_ids: Some(vec![ctx.owner.clone()]), ..Default::default() @@ -103,7 +103,7 @@ impl IamCpAccountApi { ..Default::default() }, rel_rbum_item_disabled: Some(false), - table_rbum_set_cate_is_left: Some(true), + rel_rbum_item_can_not_exist: Some(true), rel_rbum_set_id: Some(set_id.clone()), rel_rbum_set_cate_sys_codes: Some(cate_codes), sys_code_query_kind: Some(RbumSetCateLevelQueryKind::CurrentAndSub), @@ -143,7 +143,7 @@ impl IamCpAccountApi { ..Default::default() }, rel_rbum_item_disabled: Some(false), - table_rbum_set_cate_is_left: Some(true), + rel_rbum_item_can_not_exist: Some(true), rel_rbum_set_id: Some(set_id.clone()), rel_rbum_item_ids: Some(vec![ctx.owner.clone()]), ..Default::default() @@ -167,7 +167,7 @@ impl IamCpAccountApi { ..Default::default() }, rel_rbum_item_disabled: Some(false), - table_rbum_set_cate_is_left: Some(true), + rel_rbum_item_can_not_exist: Some(true), rel_rbum_set_id: Some(set_id.clone()), rel_rbum_set_cate_sys_codes: Some(cate_codes), sys_code_query_kind: Some(RbumSetCateLevelQueryKind::CurrentAndSub), diff --git a/backend/supports/iam/src/console_passport/api/iam_cp_app_api.rs b/backend/supports/iam/src/console_passport/api/iam_cp_app_api.rs index 5aef030aa..0d8736ec5 100644 --- a/backend/supports/iam/src/console_passport/api/iam_cp_app_api.rs +++ b/backend/supports/iam/src/console_passport/api/iam_cp_app_api.rs @@ -94,7 +94,7 @@ impl IamCpAppApi { ..Default::default() }, rel_rbum_item_disabled: Some(false), - table_rbum_set_cate_is_left: Some(true), + rel_rbum_item_can_not_exist: Some(true), rel_rbum_set_id: Some(set_id.clone()), rel_rbum_item_ids: Some(vec![ctx.owner.clone()]), ..Default::default() @@ -118,7 +118,7 @@ impl IamCpAppApi { ..Default::default() }, rel_rbum_item_disabled: Some(false), - table_rbum_set_cate_is_left: Some(true), + rel_rbum_item_can_not_exist: Some(true), rel_rbum_set_id: Some(set_id.clone()), rel_rbum_set_cate_sys_codes: Some(cate_codes), sys_code_query_kind: Some(RbumSetCateLevelQueryKind::CurrentAndSub), diff --git a/backend/supports/iam/src/console_tenant/api/iam_ct_account_api.rs b/backend/supports/iam/src/console_tenant/api/iam_ct_account_api.rs index 5eb7451ab..211b286b7 100644 --- a/backend/supports/iam/src/console_tenant/api/iam_ct_account_api.rs +++ b/backend/supports/iam/src/console_tenant/api/iam_ct_account_api.rs @@ -381,7 +381,7 @@ impl IamCtAccountApi { ..Default::default() }, rel_rbum_item_disabled: Some(false), - table_rbum_set_cate_is_left: Some(true), + rel_rbum_item_can_not_exist: Some(true), rel_rbum_set_id: Some(set_id.clone()), rel_rbum_item_kind_ids: Some(vec![funs.iam_basic_kind_account_id()]), rel_rbum_set_cate_sys_codes: cate_sys_codes.0.map(|codes| codes.split(',').map(|code| code.to_string()).collect::>()), diff --git a/backend/supports/iam/src/console_tenant/api/iam_ct_app_api.rs b/backend/supports/iam/src/console_tenant/api/iam_ct_app_api.rs index f782ee75b..7305c063e 100644 --- a/backend/supports/iam/src/console_tenant/api/iam_ct_app_api.rs +++ b/backend/supports/iam/src/console_tenant/api/iam_ct_app_api.rs @@ -153,7 +153,7 @@ impl IamCtAppApi { ..Default::default() }, rel_rbum_item_disabled: Some(false), - table_rbum_set_cate_is_left: Some(true), + rel_rbum_item_can_not_exist: Some(true), rel_rbum_set_id: Some(set_id.clone()), rel_rbum_item_kind_ids: Some(vec![funs.iam_basic_kind_app_id()]), rel_rbum_set_cate_sys_codes: cate_sys_codes.0.map(|codes| codes.split(',').map(|code| code.to_string()).collect::>()), diff --git a/backend/supports/reach/src/dto/message/mod.rs b/backend/supports/reach/src/dto/message/mod.rs index 114f8aeec..e87959428 100644 --- a/backend/supports/reach/src/dto/message/mod.rs +++ b/backend/supports/reach/src/dto/message/mod.rs @@ -86,7 +86,6 @@ pub struct ReachMessageSummaryResp { pub owner: String, pub create_time: DateTime, pub update_time: DateTime, - // pub rbum_safe_summary_resp: RbumSafeSummaryResp, #[oai(validator(max_length = "2000"))] pub from_res: String, pub rel_reach_channel: ReachChannelKind,