1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
use std::collections::BTreeSet;
use chrono::{NaiveDate, DateTime, UTC};
use utils::{Address, WalletAddress, Amount};
use DTO;
#[derive(RustcEncodable, RustcDecodable)]
pub struct UserDTO {
pub user_id: u64,
pub username: String,
pub display_name: String,
pub email: String,
pub email_confirmed: bool,
pub first_name: Option<String>,
pub first_name_confirmed: bool,
pub last_name: Option<String>,
pub last_name_confirmed: bool,
pub device_count: u8,
pub wallet_addresses: BTreeSet<WalletAddress>,
pub pending_balance: Amount,
pub checking_balance: Amount,
pub cold_balance: Amount,
pub birthday: Option<NaiveDate>,
pub birthday_confirmed: bool,
pub phone: Option<String>,
pub phone_confirmed: bool,
pub image_url: Option<String>,
pub address: Option<Address>,
pub address_confirmed: bool,
pub sybil_score: i8,
pub trust_score: i8,
pub enabled: bool,
pub registration_time: DateTime<UTC>,
pub last_activity: DateTime<UTC>,
pub banned: Option<DateTime<UTC>>,
}
impl DTO for UserDTO {}
#[derive(Debug, Clone, RustcEncodable, RustcDecodable)]
pub struct ProfileDTO {
pub user_id: u64,
pub display_name: String,
pub first_name: Option<String>,
pub last_name: Option<String>,
pub image_url: Option<String>,
pub age: Option<u8>,
pub address: Option<String>,
pub trust_score: i8,
}
impl DTO for ProfileDTO {}
#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct UpdateUserDTO {
pub new_username: Option<String>,
pub old_password: Option<String>,
pub new_password: Option<String>,
pub new_first: Option<String>,
pub new_last: Option<String>,
pub new_address: Option<Address>,
pub new_birthday: Option<NaiveDate>,
pub new_phone: Option<String>,
pub new_email: Option<String>,
pub new_image: Option<String>,
}
impl DTO for UpdateUserDTO {}
#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct SearchUserDTO {
pub random: Option<String>,
pub username: Option<String>,
pub email: Option<String>,
pub first_name: Option<String>,
pub last_name: Option<String>,
pub age: Option<u8>,
pub country: Option<String>,
pub state: Option<String>,
pub city: Option<String>,
pub phone: Option<String>,
pub all: bool,
pub include_me: bool,
pub include_friends: bool,
}
impl DTO for SearchUserDTO {}