removed route (#637)

* removed route

* email change support
This commit is contained in:
Wyatt Verchere
2023-06-13 14:43:20 -07:00
committed by GitHub
parent ea043517c5
commit dd3599f5b3
3 changed files with 46 additions and 34 deletions

View File

@@ -186,13 +186,6 @@ pub struct EditUser {
skip_serializing_if = "Option::is_none",
with = "::serde_with::rust::double_option"
)]
#[validate(email, length(max = 2048))]
pub email: Option<Option<String>>,
#[serde(
default,
skip_serializing_if = "Option::is_none",
with = "::serde_with::rust::double_option"
)]
#[validate(length(max = 160))]
pub bio: Option<Option<String>>,
pub role: Option<Role>,
@@ -290,20 +283,6 @@ pub async fn user_edit(
.await?;
}
if let Some(email) = &new_user.email {
sqlx::query!(
"
UPDATE users
SET email = $1
WHERE (id = $2)
",
email.as_deref(),
id as crate::database::models::ids::UserId,
)
.execute(&mut *transaction)
.await?;
}
if let Some(role) = &new_user.role {
if !user.role.is_admin() {
return Err(ApiError::CustomAuthentication(