Skip to content

Commit

Permalink
refactor: make get_dashboard_entry_response function take onwership o…
Browse files Browse the repository at this point in the history
…f user and user_role
  • Loading branch information
ThisIsMani committed Dec 4, 2023
1 parent 996c3dd commit ed0b617
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions crates/router/src/core/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub async fn signup(
let token = utils::user::generate_jwt_auth_token(state, &user_from_db, &user_role).await?;

Ok(ApplicationResponse::Json(
utils::user::get_dashboard_entry_response(&user_from_db, &user_role, token),
utils::user::get_dashboard_entry_response(user_from_db, user_role, token),
))
}

Expand All @@ -121,7 +121,7 @@ pub async fn signin(
let token = utils::user::generate_jwt_auth_token(state, &user_from_db, &user_role).await?;

Ok(ApplicationResponse::Json(
utils::user::get_dashboard_entry_response(&user_from_db, &user_role, token),
utils::user::get_dashboard_entry_response(user_from_db, user_role, token),
))
}

Expand Down
8 changes: 4 additions & 4 deletions crates/router/src/utils/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,17 @@ pub async fn generate_jwt_auth_token_with_custom_merchant_id(
}

pub fn get_dashboard_entry_response(
user: &UserFromStorage,
user_role: &UserRole,
user: UserFromStorage,
user_role: UserRole,
token: Secret<String>,
) -> user_api::DashboardEntryResponse {
user_api::DashboardEntryResponse {
merchant_id: user_role.merchant_id.clone(),
merchant_id: user_role.merchant_id,
token,
name: user.get_name(),
email: user.get_email(),
user_id: user.get_user_id().to_string(),
verification_days_left: None,
user_role: user_role.role_id.clone(),
user_role: user_role.role_id,
}
}

0 comments on commit ed0b617

Please sign in to comment.