Got it working
This commit is contained in:
@@ -257,9 +257,9 @@ pub mod endpoint {
|
||||
if payload.is_valid() {
|
||||
match contact_repo::get(&pool, &payload.id).await {
|
||||
Ok(contact) => {
|
||||
let mut old_firstname: Option<String> = contact.firstname.clone();
|
||||
let mut old_lastname: Option<String> = contact.lastname.clone();
|
||||
let mut old_nickname: Option<String> = contact.nickname.clone();
|
||||
let old_firstname: Option<String> = contact.firstname.clone();
|
||||
let old_lastname: Option<String> = contact.lastname.clone();
|
||||
let old_nickname: Option<String> = contact.nickname.clone();
|
||||
let new_firstname = match payload.firstname {
|
||||
Some(firstname) => Some(firstname),
|
||||
None => None,
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ pub mod endpoints {
|
||||
/// Constant for getting Contact endpoint
|
||||
pub const GET_CONTACT: &str = "/api/v1/contact";
|
||||
/// 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 {
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ pub mod host {
|
||||
pub mod init {
|
||||
use std::time::Duration;
|
||||
|
||||
use axum::routing::{get, post};
|
||||
use axum::routing::{get, patch, post};
|
||||
use tower_http::timeout::TimeoutLayer;
|
||||
use utoipa::OpenApi;
|
||||
|
||||
@@ -97,7 +97,7 @@ pub mod init {
|
||||
)
|
||||
.route(
|
||||
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>),
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user