tsk-51: Functionality of endpoint is almost done
Some checks failed
Rust Build / Check (pull_request) Failing after 49s
Rust Build / Rustfmt (pull_request) Successful in 32s
Rust Build / Test Suite (pull_request) Failing after 1m7s
Rust Build / Clippy (pull_request) Failing after 1m5s
Rust Build / build (pull_request) Failing after 35s

This commit is contained in:
2025-08-10 17:19:57 -04:00
parent 90342dd493
commit 2e4c289998
3 changed files with 104 additions and 5 deletions

View File

@@ -169,7 +169,43 @@ pub mod endpoint {
if token_stuff::is_token_type_valid(&token_type) {
// let (token_literal, dur) = token_stuff::create_service_refresh_token(&key, )
(axum::http::StatusCode::OK, axum::Json(response))
// Get passphrase record with id
// match repo::service::get_passphrase
match token_stuff::extract_id_from_token(&key, &payload.access_token) {
Ok(id) => {
match repo::service::get_passphrase(&pool, &id).await {
Ok((returned_id, _, _)) => {
match token_stuff::create_service_refresh_token(&key, &returned_id)
{
Ok((access_token, exp_dur)) => {
let login_result =
icarus_models::login_result::LoginResult {
id: returned_id,
token: access_token,
expiration: exp_dur,
token_type: String::from(
icarus_models::token::TOKEN_TYPE,
),
username: String::from("service"),
};
}
Err(err) => {}
}
/*
*/
(axum::http::StatusCode::OK, axum::Json(response))
}
Err(err) => {
response.message = err.to_string();
(axum::http::StatusCode::OK, axum::Json(response))
}
}
}
Err(err) => {
response.message = err.to_string();
(axum::http::StatusCode::OK, axum::Json(response))
}
}
} else {
response.message = String::from("Invalid token type");
(axum::http::StatusCode::NOT_FOUND, axum::Json(response))