diff --git a/src/callers/login.rs b/src/callers/login.rs index 84e790a..a2e8f79 100644 --- a/src/callers/login.rs +++ b/src/callers/login.rs @@ -14,6 +14,7 @@ pub mod response { #[derive(Default, Deserialize, Serialize)] pub struct Response { pub message: String, + pub data: Vec, } } @@ -66,6 +67,13 @@ pub mod endpoint { StatusCode::OK, Json(response::Response { 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 { @@ -73,6 +81,7 @@ pub mod endpoint { StatusCode::BAD_REQUEST, Json(response::Response { message: String::from("Not implemented"), + data: vec![icarus_models::login_result::LoginResult::default()], }), ) } diff --git a/src/lib.rs b/src/lib.rs index 67b590b..9942006 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -45,7 +45,7 @@ pub mod db { sqlx::migrate!("./migrations") .run(pool) .await - .expect("Failed to run migrations on testcontainer DB"); + .expect("Failed to run migrations"); } } diff --git a/src/main.rs b/src/main.rs index c9c136c..4a516b8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,6 +31,10 @@ mod init { callers::endpoints::REGISTER, post(callers::register::register_user), ) + .route( + callers::endpoints::LOGIN, + post(callers::login::endpoint::login), + ) } pub async fn app() -> Router {