feat(export): add space overwrites export
zhenyi committed
Added lib/export/space/overwrites.rs lib/export/space/overwrites.rs +61 −0 View lib/export/space/overwrites.rs
@@ -0,0 +1,61 @@
1use db::channel::channel_overwrite_role as role_ow_entity;
2use db::channel::channel_overwrite_users as user_ow_entity;
3use serde::{Deserialize, Serialize};
4use utoipa::ToSchema;
5use uuid::Uuid;
6
7#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, ToSchema)]
8pub struct RoleOverwriteView {
9 pub id: Uuid,
10 pub space_id: Uuid,
11 pub channel_id: Uuid,
12 pub role_id: Uuid,
13 pub allow_mask: i64,
14 pub deny_mask: i64,
15}
16
17impl From<role_ow_entity::Model> for RoleOverwriteView {
18 fn from(m: role_ow_entity::Model) -> Self {
19 Self {
20 id: m.id,
21 space_id: m.space_id,
22 channel_id: m.channel_id,
23 role_id: m.role_id,
24 allow_mask: m.allow_mask,
25 deny_mask: m.deny_mask,
26 }
27 }
28}
29
30#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
31pub struct SetRoleOverwriteCmd {
32 pub role_id: Uuid,
33 pub allow_mask: i64,
34 pub deny_mask: i64,
35}
36
37#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, ToSchema)]
38pub struct UserOverwriteView {
39 pub channel_id: Uuid,
40 pub user_id: Uuid,
41 pub allow_mask: i64,
42 pub deny_mask: i64,
43}
44
45impl From<user_ow_entity::Model> for UserOverwriteView {
46 fn from(m: user_ow_entity::Model) -> Self {
47 Self {
48 channel_id: m.channel_id,
49 user_id: m.user_id,
50 allow_mask: m.allow_mask,
51 deny_mask: m.deny_mask,
52 }
53 }
54}
55
56#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
57pub struct SetUserOverwriteCmd {
58 pub user_id: Uuid,
59 pub allow_mask: i64,
60 pub deny_mask: i64,
61}
No newline at end of file