blob: c580226bb040d7d39fa8aede9f6512dd2cdcd884 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
use serde::Serialize;
#[derive(Serialize)]
pub struct User {
id: i64,
email: String,
username: String,
password_hash: String,
}
impl User {
pub(super) fn new(id: i64, email: String, username: String, password_hash: String) -> Self {
Self { id, email, username, password_hash }
}
pub fn id(&self) -> i64 { self.id }
pub fn email(&self) -> &str { &self.email }
pub fn username(&self) -> &str { &self.username }
pub fn password_hash(&self) -> &str { &self.password_hash }
}
|