Login endpoint #20

Merged
phoenix merged 24 commits from login_endpoint into devel 2025-04-07 01:22:59 +00:00
3 changed files with 14 additions and 1 deletions
Showing only changes of commit 200d1d0289 - Show all commits

View File

@@ -14,6 +14,7 @@ pub mod response {
#[derive(Default, Deserialize, Serialize)] #[derive(Default, Deserialize, Serialize)]
pub struct Response { pub struct Response {
pub message: String, pub message: String,
pub data: Vec<icarus_models::login_result::LoginResult>,
} }
} }
@@ -66,6 +67,13 @@ pub mod endpoint {
StatusCode::OK, StatusCode::OK,
Json(response::Response { Json(response::Response {
message: String::from("Not implemented"), message: String::from("Not implemented"),
data: vec![icarus_models::login_result::LoginResult {
id: user.id,
username: user.username,
token: token_literal,
token_type: String::from("JWT"),
expiration: -1,
}],
}), }),
) )
} else { } else {
@@ -73,6 +81,7 @@ pub mod endpoint {
StatusCode::BAD_REQUEST, StatusCode::BAD_REQUEST,
Json(response::Response { Json(response::Response {
message: String::from("Not implemented"), message: String::from("Not implemented"),
data: vec![icarus_models::login_result::LoginResult::default()],
}), }),
) )
} }

View File

@@ -45,7 +45,7 @@ pub mod db {
sqlx::migrate!("./migrations") sqlx::migrate!("./migrations")
.run(pool) .run(pool)
.await .await
.expect("Failed to run migrations on testcontainer DB"); .expect("Failed to run migrations");
} }
} }

View File

@@ -31,6 +31,10 @@ mod init {
callers::endpoints::REGISTER, callers::endpoints::REGISTER,
post(callers::register::register_user), post(callers::register::register_user),
) )
.route(
callers::endpoints::LOGIN,
post(callers::login::endpoint::login),
)
} }
pub async fn app() -> Router { pub async fn app() -> Router {