User profile edit page

This commit is contained in:
Greg Burri 2024-12-17 21:28:47 +01:00
parent 38c286e860
commit 4248d11aa9
15 changed files with 450 additions and 175 deletions

View file

@ -52,10 +52,11 @@ use axum::{
http::StatusCode,
response::{ErrorResponse, IntoResponse, Result},
};
use tracing::{event, Level};
// use tracing::{event, Level};
use crate::{data::db, model, ron_extractor::ExtractRon, ron_utils::ron_error};
#[allow(dead_code)]
#[debug_handler]
pub async fn update_user(
State(connection): State<db::Connection>,
@ -66,7 +67,7 @@ pub async fn update_user(
connection
.update_user(
user.id,
ron.email.as_deref(),
ron.email.as_deref().map(str::trim),
ron.name.as_deref(),
ron.password.as_deref(),
)
@ -82,6 +83,6 @@ pub async fn update_user(
///// 404 /////
#[debug_handler]
pub async fn not_found(Extension(user): Extension<Option<model::User>>) -> impl IntoResponse {
pub async fn not_found(Extension(_user): Extension<Option<model::User>>) -> impl IntoResponse {
ron_error(StatusCode::NOT_FOUND, "Not found")
}