Got it working

This commit is contained in:
2026-06-15 22:39:50 -04:00
parent 37bce752ff
commit 76bb3a1f62
3 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -257,9 +257,9 @@ pub mod endpoint {
if payload.is_valid() { if payload.is_valid() {
match contact_repo::get(&pool, &payload.id).await { match contact_repo::get(&pool, &payload.id).await {
Ok(contact) => { Ok(contact) => {
let mut old_firstname: Option<String> = contact.firstname.clone(); let old_firstname: Option<String> = contact.firstname.clone();
let mut old_lastname: Option<String> = contact.lastname.clone(); let old_lastname: Option<String> = contact.lastname.clone();
let mut old_nickname: Option<String> = contact.nickname.clone(); let old_nickname: Option<String> = contact.nickname.clone();
let new_firstname = match payload.firstname { let new_firstname = match payload.firstname {
Some(firstname) => Some(firstname), Some(firstname) => Some(firstname),
None => None, None => None,
+1 -1
View File
@@ -8,7 +8,7 @@ pub mod endpoints {
/// Constant for getting Contact endpoint /// Constant for getting Contact endpoint
pub const GET_CONTACT: &str = "/api/v1/contact"; pub const GET_CONTACT: &str = "/api/v1/contact";
/// Constant for updating names of a Contact endpoint /// Constant for updating names of a Contact endpoint
pub const UPDATE_CONTACT_NAME: &str = "/api/v1/contact/new"; pub const UPDATE_CONTACT_NAME: &str = "/api/v1/contact/update";
} }
pub mod response { pub mod response {
+2 -2
View File
@@ -10,7 +10,7 @@ pub mod host {
pub mod init { pub mod init {
use std::time::Duration; use std::time::Duration;
use axum::routing::{get, post}; use axum::routing::{get, patch, post};
use tower_http::timeout::TimeoutLayer; use tower_http::timeout::TimeoutLayer;
use utoipa::OpenApi; use utoipa::OpenApi;
@@ -97,7 +97,7 @@ pub mod init {
) )
.route( .route(
crate::caller::endpoints::UPDATE_CONTACT_NAME, crate::caller::endpoints::UPDATE_CONTACT_NAME,
get(contact_endpoints::update_contact_names).route_layer( patch(contact_endpoints::update_contact_names).route_layer(
axum::middleware::from_fn(crate::auth::auth::<axum::body::Body>), axum::middleware::from_fn(crate::auth::auth::<axum::body::Body>),
), ),
) )