Working on upload images and tilemap
This commit is contained in:
@@ -29,6 +29,7 @@ impl RegisterUser {
|
||||
last_name: self.last_name,
|
||||
updated_at: chrono::Utc::now().naive_utc(),
|
||||
created_at: chrono::Utc::now().naive_utc(),
|
||||
profile: None,
|
||||
verified: false,
|
||||
})
|
||||
}
|
||||
@@ -50,6 +51,7 @@ pub struct QueryUser {
|
||||
pub last_name: String,
|
||||
pub updated_at: chrono::NaiveDateTime,
|
||||
pub created_at: chrono::NaiveDateTime,
|
||||
pub profile: Option<String>,
|
||||
pub verified: bool,
|
||||
}
|
||||
|
||||
@@ -75,6 +77,7 @@ pub struct InsertUser {
|
||||
pub last_name: String,
|
||||
pub updated_at: chrono::NaiveDateTime,
|
||||
pub created_at: chrono::NaiveDateTime,
|
||||
pub profile: Option<String>,
|
||||
pub verified: bool,
|
||||
}
|
||||
|
||||
@@ -86,6 +89,15 @@ impl InsertUser {
|
||||
.get_result(&mut conn)?;
|
||||
Ok(user)
|
||||
}
|
||||
|
||||
pub fn update_profile(email: &str, profile: Option<&str>) -> Result<QueryUser, ServiceError> {
|
||||
let mut conn = connection()?;
|
||||
let user = diesel::update(users::table)
|
||||
.filter(users::email.eq(&email))
|
||||
.set(users::profile.eq(profile))
|
||||
.get_result(&mut conn)?;
|
||||
Ok(user)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
|
||||
Reference in New Issue
Block a user