Compare commits

..
1 Commits
Author SHA1 Message Date
phoenix e82a62dec4 tsk-14: Update user profile (#15)
Release Tagging / release (push) Successful in 16s
soaricarus_auth Build / build (push) Successful in 1m5s
soaricarus_auth Build / Rustfmt (push) Successful in 1m10s
soaricarus_auth Build / Check (push) Successful in 1m16s
soaricarus_auth Build / Clippy (push) Successful in 1m19s
soaricarus_auth Build / Test Suite (push) Successful in 1m19s
Closes #14

Reviewed-on: http://git.kundeng.us/phoenix/soaricarus_auth/pulls/15
2026-11-11 13:13:49 -05:00
+27 -20
View File
@@ -508,27 +508,34 @@ pub mod endpoint {
Ok(user) => {
let firstname = payload.firstname;
let lastname = payload.lastname;
match repo::user::update_user_profile(&pool, &user_id, &firstname, &lastname)
if firstname == user.firstname && lastname == user.lastname {
(axum::http::StatusCode::NOT_MODIFIED, axum::Json(response))
} else {
match repo::user::update_user_profile(
&pool, &user_id, &firstname, &lastname,
)
.await
{
Ok(_) => {
let user_profile = simodels::user::UserProfile {
firstname,
lastname,
username: user.username,
email: user.email,
};
response.message = "SUCCESSFUL".to_string();
response.data.push(user_profile);
(axum::http::StatusCode::OK, axum::Json(response))
}
Err(err) => {
eprintln!("Error: {err:?}");
response.message = "ERROR - Updating user profile".to_string();
(
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(response),
)
{
Ok(_) => {
let user_profile = simodels::user::UserProfile {
firstname,
lastname,
username: user.username,
email: user.email,
};
response.message = "SUCCESSFUL".to_string();
response.data.push(user_profile);
(axum::http::StatusCode::OK, axum::Json(response))
}
Err(err) => {
eprintln!("Error: {err:?}");
response.message = "ERROR - Updating user profile".to_string();
(
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(response),
)
}
}
}
}