diff --git a/crates/router/src/core/user.rs b/crates/router/src/core/user.rs index a0fd8272ff39..629ec7c0f8a9 100644 --- a/crates/router/src/core/user.rs +++ b/crates/router/src/core/user.rs @@ -1,7 +1,10 @@ use api_models::user as user_api; use diesel_models::{enums::UserStatus, user as storage_user}; -use error_stack::{IntoReport, ResultExt}; +#[cfg(feature = "email")] +use error_stack::IntoReport; +use error_stack::ResultExt; use masking::ExposeInterface; +#[cfg(feature = "email")] use router_env::env; #[cfg(feature = "email")] use router_env::logger; @@ -21,6 +24,7 @@ pub mod dashboard_metadata; #[cfg(feature = "dummy_connector")] pub mod sample_data; +#[cfg(feature = "email")] pub async fn signup_with_merchant_id( state: AppState, request: user_api::SignUpWithMerchantIdRequest, @@ -89,9 +93,9 @@ pub async fn signup( .await?; let token = utils::user::generate_jwt_auth_token(state, &user_from_db, &user_role).await?; - return Ok(ApplicationResponse::Json( + Ok(ApplicationResponse::Json( utils::user::get_dashboard_entry_response(&user_from_db, &user_role, token), - )); + )) } pub async fn signin( @@ -116,9 +120,9 @@ pub async fn signin( let user_role = user_from_db.get_role_from_db(state.clone()).await?; let token = utils::user::generate_jwt_auth_token(state, &user_from_db, &user_role).await?; - return Ok(ApplicationResponse::Json( + Ok(ApplicationResponse::Json( utils::user::get_dashboard_entry_response(&user_from_db, &user_role, token), - )); + )) } #[cfg(feature = "email")] @@ -379,8 +383,7 @@ pub async fn switch_merchant_id( &user_role, request.merchant_id.clone(), ) - .await? - .into(); + .await?; Ok(ApplicationResponse::Json( user_api::SwitchMerchantResponse { diff --git a/crates/router/src/routes/user.rs b/crates/router/src/routes/user.rs index 414c4433d69e..45fa0ba35c59 100644 --- a/crates/router/src/routes/user.rs +++ b/crates/router/src/routes/user.rs @@ -19,6 +19,7 @@ use crate::{ utils::user::dashboard_metadata::{parse_string_to_enums, set_ip_address_if_required}, }; +#[cfg(feature = "email")] pub async fn user_signup_with_merchant_id( state: web::Data, http_req: HttpRequest, @@ -76,6 +77,7 @@ pub async fn user_signin( .await } +#[cfg(feature = "email")] pub async fn user_connect_account( state: web::Data, http_req: HttpRequest,