cargo fmt
soaricarus_auth Build / Rustfmt (pull_request) Successful in 51s
soaricarus_auth Build / Clippy (pull_request) Successful in 52s
soaricarus_auth Build / build (pull_request) Successful in 52s
soaricarus_auth Build / Check (pull_request) Successful in 59s
soaricarus_auth Build / Test Suite (pull_request) Failing after 59s

This commit is contained in:
phoenix committed 2026-10-08 17:01:52 -04:00
1 parent 7ade92e0b8
commit cb4b30b4ad
3 files changed
+64 -38

No files matched your search

+9 -4
View File
@@ -43,7 +43,6 @@ pub mod request {
}
}
}
}
pub mod response {
@@ -414,7 +413,10 @@ pub mod endpoint {
pub async fn get_user_profile(
axum::Extension(pool): axum::Extension<sqlx::PgPool>,
axum::extract::Path(id): axum::extract::Path<uuid::Uuid>,
) -> (axum::http::StatusCode, axum::Json<super::response::get_user_profile::GetUserProfileResponse>) {
) -> (
axum::http::StatusCode,
axum::Json<super::response::get_user_profile::GetUserProfileResponse>,
) {
let mut response = super::response::get_user_profile::GetUserProfileResponse::default();
if id.is_nil() {
response.message = "Invalid request".to_string();
@@ -426,7 +428,7 @@ pub mod endpoint {
firstname: user.firstname,
lastname: user.lastname,
username: user.username,
email: user.email
email: user.email,
};
response.message = "SUCCESSFUL".to_string();
@@ -435,7 +437,10 @@ pub mod endpoint {
}
Err(err) => {
response.message = err.to_string();
(axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response))
(
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(response),
)
}
}
}
+4 -2
View File
@@ -128,8 +128,10 @@ mod init {
callers::endpoints::REFRESH_TOKEN,
post(callers::login::endpoint::refresh_token),
)
.route(callers::endpoints::GET_USER_PROFILE,
get(callers::login::endpoint::get_user_profile))
.route(
callers::endpoints::GET_USER_PROFILE,
get(callers::login::endpoint::get_user_profile),
)
.layer(cors::configure_cors().await)
}
+51 -32
View File
@@ -31,7 +31,6 @@ pub mod user {
}
}
pub async fn get_with_id(
pool: &sqlx::PgPool,
id: &uuid::Uuid,
@@ -47,43 +46,63 @@ pub mod user {
match result {
Ok(r) => match r {
Some(roww) => {
parse_row(&roww).await
}
None => {
Err(sqlx::Error::RowNotFound)
}
}
Some(roww) => parse_row(&roww).await,
None => Err(sqlx::Error::RowNotFound),
},
Err(e) => Err(e),
}
}
async fn parse_row(row: &sqlx::postgres::PgRow) -> Result<simodels::user::User, sqlx::Error> {
Ok(simodels::user::User {
id: row.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound).unwrap(),
username: row.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound).unwrap(),
password: row.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound).unwrap(),
email: row.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound).unwrap(),
phone: row.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound).unwrap(),
firstname: row.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound).unwrap(),
lastname: row.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound).unwrap(),
email_verified: row.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound).unwrap(),
date_created: row.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound).unwrap(),
status: row.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound).unwrap(),
last_login: row.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound).unwrap(),
salt_id: row.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound).unwrap(),
id: row
.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
username: row
.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
password: row
.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
email: row
.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
phone: row
.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
firstname: row
.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
lastname: row
.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
email_verified: row
.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
date_created: row
.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
status: row
.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
last_login: row
.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
salt_id: row
.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap(),
})
}