Skip to content

Commit

Permalink
Improve code comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
gudaoxuri committed Apr 26, 2024
1 parent 75e2942 commit a578704
Show file tree
Hide file tree
Showing 23 changed files with 1,000 additions and 206 deletions.
61 changes: 58 additions & 3 deletions backend/basic/src/rbum/domain/rbum_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
36 changes: 33 additions & 3 deletions backend/basic/src/rbum/domain/rbum_set_cate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down
25 changes: 22 additions & 3 deletions backend/basic/src/rbum/domain/rbum_set_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down
1 change: 0 additions & 1 deletion backend/basic/src/rbum/dto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Loading

0 comments on commit a578704

Please sign in to comment.