1
use std::collections::HashMap;
2

            
3
use chrono::{DateTime, Utc};
4
use serde::Deserialize;
5
use serde_json::{Map, Value};
6

            
7
100
#[derive(Deserialize)]
8
pub struct UserIdPath {
9
    pub user_id: String,
10
}
11

            
12
66
#[derive(Deserialize)]
13
pub struct PatchUserBody {
14
    pub data: PatchUserData,
15
}
16

            
17
96
#[derive(Deserialize)]
18
pub struct PatchUserData {
19
    pub password: Option<String>,
20
    pub name: Option<String>,
21
    pub info: Option<Map<String, Value>>,
22
}
23

            
24
42
#[derive(Deserialize)]
25
pub struct PostAdminUserBody {
26
    pub data: PostAdminUserData,
27
    #[serde(rename = "expiredAt")]
28
    pub expired_at: Option<DateTime<Utc>>,
29
}
30

            
31
60
#[derive(Deserialize)]
32
pub struct PostAdminUserData {
33
    pub account: String,
34
    pub password: String,
35
    pub name: Option<String>,
36
    pub info: Option<Map<String, Value>>,
37
}
38

            
39
52
#[derive(Deserialize)]
40
pub struct GetAdminUserCountQuery {
41
    pub account: Option<String>,
42
    pub contains: Option<String>,
43
}
44

            
45
224
#[derive(Clone, Deserialize)]
46
pub struct GetAdminUserListQuery {
47
    pub account: Option<String>,
48
    pub contains: Option<String>,
49
    pub fields: Option<String>,
50
    pub offset: Option<u64>,
51
    pub limit: Option<u64>,
52
    pub sort: Option<String>,
53
    pub format: Option<ListFormat>,
54
}
55

            
56
78
#[derive(Deserialize)]
57
pub struct PatchAdminUserBody {
58
    pub data: Option<PatchAdminUserData>,
59
    pub disable: Option<bool>,
60
}
61

            
62
60
#[derive(Deserialize)]
63
pub struct PatchAdminUserData {
64
    #[serde(rename = "verifiedAt")]
65
    pub verified_at: Option<String>,
66
    pub roles: Option<HashMap<String, bool>>,
67
    pub password: Option<String>,
68
    pub name: Option<String>,
69
    pub info: Option<Map<String, Value>>,
70
}
71

            
72
8
#[derive(Clone, Deserialize, PartialEq)]
73
pub enum ListFormat {
74
    #[serde(rename = "array")]
75
    Array,
76
    #[serde(rename = "data")]
77
    Data,
78
}