r2_data_persistence/models/
user.rs

1use crate::schema::user;
2use diesel::{AsChangeset, Insertable};
3
4pub struct GetUserModel {
5    pub id: String,
6    pub email: String,
7    pub username: String,
8    pub profile_picture: String,
9    pub all_time_accuracy: f32,
10    pub all_time_highscore: i32,
11    pub rank: i32,
12    pub percent: f32,
13}
14
15#[derive(Insertable, Clone)]
16#[diesel(table_name = user)]
17pub struct CreateUserModel {
18    pub email: String,
19    pub password: String,
20    pub username: String,
21    pub profile_picture: String,
22    pub all_time_accuracy: f32,
23    pub all_time_highscore: i32,
24    pub rank: i32,
25    pub percent: f32,
26}
27
28#[derive(AsChangeset)]
29#[diesel(table_name = user)]
30pub struct UpdateUserModel {
31    pub email: Option<String>,
32    pub password: Option<String>,
33    pub username: Option<String>,
34    pub profile_picture: Option<String>,
35    pub all_time_accuracy: Option<f32>,
36    pub all_time_highscore: Option<i32>,
37    pub rank: Option<i32>,
38    pub percent: Option<f32>,
39}