bios_basic/rbum/dto/
rbum_domain_dto.rs

1use serde::{Deserialize, Serialize};
2use tardis::basic::field::TrimString;
3use tardis::chrono::{DateTime, Utc};
4
5use tardis::db::sea_orm;
6
7use tardis::web::poem_openapi;
8
9use crate::rbum::rbum_enumeration::RbumScopeLevelKind;
10
11/// Add request for resource domain
12///
13/// 资源域添加请求
14#[derive(Serialize, Deserialize, Debug, poem_openapi::Object)]
15pub struct RbumDomainAddReq {
16    /// Resource domain code
17    ///
18    /// 资源域编码
19    ///
20    /// Global unique
21    ///
22    /// 全局唯一
23    ///
24    /// Which is required to conform to the host specification in the uri, matching the regular: ^[a-z0-9-.]+$.
25    ///
26    /// 需要符合uri中的host规范,匹配正则:^[a-z0-9-.]+$。
27    #[oai(validator(min_length = "2", max_length = "255"))]
28    pub code: TrimString,
29    /// Resource domain name
30    ///
31    /// 资源域名称
32    #[oai(validator(min_length = "2", max_length = "255"))]
33    pub name: TrimString,
34    /// Resource domain note
35    ///
36    /// 资源域备注
37    #[oai(validator(min_length = "2", max_length = "2000"))]
38    pub note: Option<String>,
39    /// Resource domain icon
40    ///
41    /// 资源域图标
42    #[oai(validator(min_length = "2", max_length = "1000"))]
43    pub icon: Option<String>,
44    /// Resource domain sort
45    ///
46    /// 资源域排序
47    pub sort: Option<i64>,
48
49    pub scope_level: Option<RbumScopeLevelKind>,
50}
51
52/// Modify request for resource domain
53///
54/// 资源域修改请求
55#[derive(Serialize, Deserialize, Debug, poem_openapi::Object)]
56pub struct RbumDomainModifyReq {
57    /// Resource domain name
58    ///
59    /// 资源域名称
60    #[oai(validator(min_length = "2", max_length = "255"))]
61    pub name: Option<TrimString>,
62    /// Resource domain note
63    ///
64    /// 资源域备注
65    #[oai(validator(min_length = "2", max_length = "2000"))]
66    pub note: Option<String>,
67    /// Resource domain icon
68    ///
69    /// 资源域图标
70    #[oai(validator(min_length = "2", max_length = "1000"))]
71    pub icon: Option<String>,
72    /// Resource domain sort
73    ///
74    /// 资源域排序
75    pub sort: Option<i64>,
76    /// Resource domain scope level
77    ///
78    /// 资源域作用域级别
79    ///
80    /// Default is ``private``
81    ///
82    /// 默认为``私有``
83    pub scope_level: Option<RbumScopeLevelKind>,
84}
85
86/// Resource domain summary information
87///
88/// 资源域概要信息
89#[derive(Serialize, Deserialize, Debug, Clone, poem_openapi::Object, sea_orm::FromQueryResult)]
90pub struct RbumDomainSummaryResp {
91    /// Resource domain id
92    ///
93    /// 资源域id
94    pub id: String,
95    /// Resource domain code
96    ///
97    /// 资源域编码
98    pub code: String,
99    /// Resource domain name
100    ///
101    /// 资源域名称
102    pub name: String,
103    /// Resource domain icon
104    ///
105    /// 资源域图标
106    pub icon: String,
107    /// Resource domain sort
108    ///
109    /// 资源域排序
110    pub sort: i64,
111
112    pub own_paths: String,
113    pub owner: String,
114    pub create_time: DateTime<Utc>,
115    pub update_time: DateTime<Utc>,
116
117    pub scope_level: RbumScopeLevelKind,
118}
119
120/// Resource domain detail information
121///
122/// 资源域详细信息
123#[derive(Serialize, Deserialize, Debug, poem_openapi::Object, sea_orm::FromQueryResult)]
124pub struct RbumDomainDetailResp {
125    /// Resource domain id
126    ///
127    /// 资源域id
128    pub id: String,
129    /// Resource domain code
130    ///
131    /// 资源域编码
132    pub code: String,
133    /// Resource domain name
134    ///
135    /// 资源域名称
136    pub name: String,
137    /// Resource domain note
138    ///
139    /// 资源域备注
140    pub note: String,
141    /// Resource domain icon
142    ///
143    /// 资源域图标
144    pub icon: String,
145    pub sort: i64,
146
147    pub own_paths: String,
148    pub owner: String,
149    pub owner_name: Option<String>,
150    pub create_time: DateTime<Utc>,
151    pub update_time: DateTime<Utc>,
152
153    pub scope_level: RbumScopeLevelKind,
154}