Skip to content

Commit

Permalink
make the type as a struct
Browse files Browse the repository at this point in the history
  • Loading branch information
Aprabhat19 committed Nov 10, 2023
1 parent f68465f commit b854930
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
5 changes: 4 additions & 1 deletion crates/api_models/src/routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,10 @@ pub enum RoutingAlgorithmKind {

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]

pub struct RoutingPayloadWrapper(pub Vec<RoutableConnectorChoice>, pub String);
pub struct RoutingPayloadWrapper {
pub updated_config: Vec<RoutableConnectorChoice>,
pub profile_id: String,
}

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(
Expand Down
11 changes: 6 additions & 5 deletions crates/router/src/routes/routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,20 +328,21 @@ pub async fn routing_update_default_config_for_profile(
path: web::Path<String>,
json_payload: web::Json<Vec<routing_types::RoutableConnectorChoice>>,
) -> impl Responder {
let routing_payload_wrapper =
routing_types::RoutingPayloadWrapper(json_payload.into_inner(), path.into_inner());
let routing_payload_wrapper = routing_types::RoutingPayloadWrapper {
updated_config: json_payload.into_inner(),
profile_id: path.into_inner(),
};
oss_api::server_wrap(
Flow::RoutingUpdateDefaultConfig,
state,
&req,
routing_payload_wrapper,
|state, auth: oss_auth::AuthenticationData, wrapper| {
let (updated_config, profile_id) = (wrapper.0, wrapper.1);
routing::update_default_routing_config_for_profile(
state,
auth.merchant_account,
updated_config,
profile_id,
wrapper.updated_config,
wrapper.profile_id,
)
},
#[cfg(not(feature = "release"))]
Expand Down

0 comments on commit b854930

Please sign in to comment.