mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
refactor(ext_traits): simplify the signatures of some methods in Encode extension trait (#3687)
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
use api_models::{
|
||||
conditional_configs::{DecisionManager, DecisionManagerRecord, DecisionManagerResponse},
|
||||
routing::{self},
|
||||
routing,
|
||||
};
|
||||
use common_utils::ext_traits::{StringExt, ValueExt};
|
||||
use common_utils::ext_traits::{Encode, StringExt, ValueExt};
|
||||
use diesel_models::configs;
|
||||
use error_stack::{IntoReport, ResultExt};
|
||||
use euclid::frontend::ast;
|
||||
@ -15,7 +15,7 @@ use crate::{
|
||||
routes::AppState,
|
||||
services::api as service_api,
|
||||
types::domain,
|
||||
utils::{self, OptionExt},
|
||||
utils::OptionExt,
|
||||
};
|
||||
|
||||
pub async fn upsert_conditional_config(
|
||||
@ -86,10 +86,10 @@ pub async fn upsert_conditional_config(
|
||||
created_at: previous_record.created_at,
|
||||
};
|
||||
|
||||
let serialize_updated_str =
|
||||
utils::Encode::<DecisionManagerRecord>::encode_to_string_of_json(&new_algo)
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("Unable to serialize config to string")?;
|
||||
let serialize_updated_str = new_algo
|
||||
.encode_to_string_of_json()
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("Unable to serialize config to string")?;
|
||||
|
||||
let updated_config = configs::ConfigUpdate::Update {
|
||||
config: Some(serialize_updated_str),
|
||||
@ -121,10 +121,10 @@ pub async fn upsert_conditional_config(
|
||||
created_at: timestamp,
|
||||
};
|
||||
|
||||
let serialized_str =
|
||||
utils::Encode::<DecisionManagerRecord>::encode_to_string_of_json(&new_rec)
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("Error serializing the config")?;
|
||||
let serialized_str = new_rec
|
||||
.encode_to_string_of_json()
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("Error serializing the config")?;
|
||||
let new_config = configs::ConfigNew {
|
||||
key: key.clone(),
|
||||
config: serialized_str,
|
||||
|
||||
Reference in New Issue
Block a user