Compare commits
1
Commits
453538582b
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e82a62dec4 |
No files matched your search
@@ -508,7 +508,13 @@ pub mod endpoint {
|
|||||||
Ok(user) => {
|
Ok(user) => {
|
||||||
let firstname = payload.firstname;
|
let firstname = payload.firstname;
|
||||||
let lastname = payload.lastname;
|
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
|
.await
|
||||||
{
|
{
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
@@ -532,6 +538,7 @@ pub mod endpoint {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
eprintln!("Error: {err:?}");
|
eprintln!("Error: {err:?}");
|
||||||
response.message = "ERROR".to_string();
|
response.message = "ERROR".to_string();
|
||||||
|
|||||||
@@ -124,7 +124,6 @@ pub mod init {
|
|||||||
put(callers::login::endpoint::update_user_profile),
|
put(callers::login::endpoint::update_user_profile),
|
||||||
)
|
)
|
||||||
.layer(cors::configure_cors().await)
|
.layer(cors::configure_cors().await)
|
||||||
.layer(cors::configure_cors().await)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn app() -> Router {
|
pub async fn app() -> Router {
|
||||||
|
|||||||
+3
-5
@@ -1,5 +1,4 @@
|
|||||||
use soaricarus_auth;
|
use soaricarus_auth::{config, init};
|
||||||
use soaricarus_auth::init;
|
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
@@ -9,7 +8,7 @@ async fn main() {
|
|||||||
let app = init::app().await;
|
let app = init::app().await;
|
||||||
|
|
||||||
// run our app with hyper, listening globally on port 8001
|
// run our app with hyper, listening globally on port 8001
|
||||||
let url = soaricarus_auth::config::get_full();
|
let url = config::get_full();
|
||||||
let listener = tokio::net::TcpListener::bind(url).await.unwrap();
|
let listener = tokio::net::TcpListener::bind(url).await.unwrap();
|
||||||
axum::serve(listener, app).await.unwrap();
|
axum::serve(listener, app).await.unwrap();
|
||||||
}
|
}
|
||||||
@@ -18,8 +17,7 @@ async fn main() {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use soaricarus_auth;
|
use soaricarus_auth;
|
||||||
use soaricarus_auth::callers;
|
use soaricarus_auth::{callers, db};
|
||||||
use soaricarus_auth::db;
|
|
||||||
|
|
||||||
use axum::{
|
use axum::{
|
||||||
body::Body,
|
body::Body,
|
||||||
|
|||||||
Reference in new issue
Block a user