1
use serde::Deserialize;
2
use serde_json::{Map, Value};
3

            
4
180
#[derive(Deserialize)]
5
pub struct UnitIdPath {
6
    pub unit_id: String,
7
}
8

            
9
18
#[derive(Deserialize)]
10
pub struct UserIdPath {
11
    pub user_id: String,
12
}
13

            
14
90
#[derive(Deserialize)]
15
pub struct PostUnitBody {
16
    pub data: PostUnitData,
17
}
18

            
19
117
#[derive(Deserialize)]
20
pub struct PostUnitData {
21
    pub code: String,
22
    #[serde(rename = "ownerId")]
23
    pub owner_id: Option<String>,
24
    pub name: Option<String>,
25
    pub info: Option<Map<String, Value>>,
26
}
27

            
28
81
#[derive(Deserialize)]
29
pub struct GetUnitCountQuery {
30
    pub owner: Option<String>,
31
    pub member: Option<String>,
32
    pub contains: Option<String>,
33
}
34

            
35
303
#[derive(Clone, Deserialize)]
36
pub struct GetUnitListQuery {
37
    pub owner: Option<String>,
38
    pub member: Option<String>,
39
    pub contains: Option<String>,
40
    pub offset: Option<u64>,
41
    pub limit: Option<u64>,
42
    pub sort: Option<String>,
43
    pub format: Option<ListFormat>,
44
}
45

            
46
84
#[derive(Deserialize)]
47
pub struct PatchUnitBody {
48
    pub data: PatchUnitData,
49
}
50

            
51
120
#[derive(Deserialize)]
52
pub struct PatchUnitData {
53
    #[serde(rename = "ownerId")]
54
    pub owner_id: Option<String>,
55
    #[serde(rename = "memberIds")]
56
    pub member_ids: Option<Vec<String>>,
57
    pub name: Option<String>,
58
    pub info: Option<Map<String, Value>>,
59
}
60

            
61
12
#[derive(Clone, Deserialize, PartialEq)]
62
pub enum ListFormat {
63
    #[serde(rename = "array")]
64
    Array,
65
    #[serde(rename = "data")]
66
    Data,
67
}