Skip to main content

bios_basic/rbum/dto/
rbum_rel_agg_dto.rs

1use serde::{Deserialize, Serialize};
2
3use tardis::web::poem_openapi;
4
5use crate::rbum::dto::rbum_rel_attr_dto::RbumRelAttrDetailResp;
6use crate::rbum::dto::rbum_rel_dto::{RbumRelAddReq, RbumRelDetailResp};
7use crate::rbum::dto::rbum_rel_env_dto::RbumRelEnvDetailResp;
8use crate::rbum::rbum_enumeration::RbumRelEnvKind;
9
10/// Add request for resource relationship aggregation
11///
12/// 资源关联聚合添加请求
13#[derive(Serialize, Deserialize, Debug, poem_openapi::Object)]
14pub struct RbumRelAggAddReq {
15    /// Relationship information
16    ///
17    /// 关联信息
18    pub rel: RbumRelAddReq,
19    /// Relationship attribute information
20    ///
21    /// 关联属性信息
22    pub attrs: Vec<RbumRelAttrAggAddReq>,
23    /// Relationship environment information
24    ///
25    /// 关联环境信息
26    pub envs: Vec<RbumRelEnvAggAddReq>,
27}
28
29/// Add request for resource relationship attribute aggregation
30///
31/// 资源关联属性聚合添加请求
32#[derive(Serialize, Deserialize, Clone, Debug, poem_openapi::Object)]
33pub struct RbumRelAttrAggAddReq {
34    /// Condition qualifier
35    ///
36    /// 条件限定符
37    ///
38    /// if true, it means the limitation of the relationship source,
39    /// otherwise it is the limitation of the relationship target resource.
40    ///
41    /// 如果为true,表示关联来源方的限定,否则为关联目标方资源的限定。
42    pub is_from: bool,
43    /// Relationship attribute value
44    ///
45    /// 关联属性值
46    #[oai(validator(min_length = "0", max_length = "2000"))]
47    pub value: String,
48    /// Relationship attribute name
49    ///
50    /// 关联属性名称
51    ///
52    /// When ``rel_rbum_kind_attr_id`` exists, use the corresponding [`crate::rbum::dto::rbum_kind_attr_dto::RbumKindAttrDetailResp::name`], otherwise this field is not empty.
53    ///
54    /// 当 ``rel_rbum_kind_attr_id`` 存在时使用其对应的 [`crate::rbum::dto::rbum_kind_attr_dto::RbumKindAttrDetailResp::name`],否则此字段不为空。
55    #[oai(validator(min_length = "2", max_length = "255"))]
56    pub name: Option<String>,
57    /// Whether to only record
58    ///
59    /// 是否仅记录
60    ///
61    /// If true, this condition is only used for records and does not participate in the judgment of whether the relationship is established.
62    ///
63    /// 如果为true,该条件仅用于记录,不参与判断关联关系是否建立。
64    pub record_only: bool,
65    /// Associated [resource kind attribute](crate::rbum::dto::rbum_kind_attr_dto::RbumKindAttrDetailResp) id
66    ///
67    /// 关联的[资源类型属性](crate::rbum::dto::rbum_kind_attr_dto::RbumKindAttrDetailResp) id
68    #[oai(validator(min_length = "2", max_length = "255"))]
69    pub rel_rbum_kind_attr_id: Option<String>,
70}
71
72/// Add request for resource relationship environment aggregation
73///
74/// 资源关联环境聚合添加请求
75#[derive(Serialize, Deserialize, Clone, Debug, poem_openapi::Object)]
76pub struct RbumRelEnvAggAddReq {
77    /// Relationship environment type
78    ///
79    /// 关联的环境类型
80    pub kind: RbumRelEnvKind,
81    /// Relationship environment value1
82    ///
83    /// 关联环境值1
84    #[oai(validator(min_length = "1", max_length = "2000"))]
85    pub value1: String,
86    /// Relationship environment value2
87    ///
88    /// 关联环境值2
89    #[oai(validator(min_length = "1", max_length = "2000"))]
90    pub value2: Option<String>,
91}
92
93/// Resource relationship aggregation detail information
94///
95/// 资源关联聚合详细信息
96#[derive(Serialize, Deserialize, Clone, Debug, poem_openapi::Object)]
97pub struct RbumRelAggResp {
98    /// Relationship information
99    ///
100    /// 关联信息
101    pub rel: RbumRelDetailResp,
102    /// Relationship attribute information
103    ///
104    /// 关联属性信息
105    pub attrs: Vec<RbumRelAttrDetailResp>,
106    /// Relationship environment information
107    ///
108    /// 关联环境信息
109    pub envs: Vec<RbumRelEnvDetailResp>,
110}