refactor: introduce a domain type for profile ID (#5687)

This commit is contained in:
Sanchith Hegde
2024-08-27 13:31:01 +05:30
committed by GitHub
parent fac8e7916f
commit b63d723b8b
118 changed files with 707 additions and 547 deletions

View File

@ -36,7 +36,8 @@ pub struct RoutingConfigRequest {
pub name: String,
pub description: String,
pub algorithm: RoutingAlgorithm,
pub profile_id: String,
#[schema(value_type = String)]
pub profile_id: common_utils::id_type::ProfileId,
}
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "routing_v2")))]
@ -45,12 +46,14 @@ pub struct RoutingConfigRequest {
pub name: Option<String>,
pub description: Option<String>,
pub algorithm: Option<RoutingAlgorithm>,
pub profile_id: Option<String>,
#[schema(value_type = Option<String>)]
pub profile_id: Option<common_utils::id_type::ProfileId>,
}
#[derive(Debug, serde::Serialize, ToSchema)]
pub struct ProfileDefaultRoutingConfig {
pub profile_id: String,
#[schema(value_type = String)]
pub profile_id: common_utils::id_type::ProfileId,
pub connectors: Vec<RoutableConnectorChoice>,
}
@ -62,13 +65,13 @@ pub struct RoutingRetrieveQuery {
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct RoutingRetrieveLinkQuery {
pub profile_id: Option<String>,
pub profile_id: Option<common_utils::id_type::ProfileId>,
}
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct RoutingRetrieveLinkQueryWrapper {
pub routing_query: RoutingRetrieveQuery,
pub profile_id: String,
pub profile_id: common_utils::id_type::ProfileId,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
/// Response of the retrieved routing configs for a merchant account
@ -87,7 +90,8 @@ pub enum LinkedRoutingConfigRetrieveResponse {
/// Routing Algorithm specific to merchants
pub struct MerchantRoutingAlgorithm {
pub id: String,
pub profile_id: String,
#[schema(value_type = String)]
pub profile_id: common_utils::id_type::ProfileId,
pub name: String,
pub description: String,
pub algorithm: RoutingAlgorithm,
@ -257,10 +261,9 @@ pub enum RoutingAlgorithmKind {
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct RoutingPayloadWrapper {
pub updated_config: Vec<RoutableConnectorChoice>,
pub profile_id: String,
pub profile_id: common_utils::id_type::ProfileId,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
@ -453,8 +456,8 @@ impl RoutingAlgorithmRef {
pub struct RoutingDictionaryRecord {
pub id: String,
pub profile_id: String,
#[schema(value_type = String)]
pub profile_id: common_utils::id_type::ProfileId,
pub name: String,
pub kind: RoutingAlgorithmKind,
pub description: String,
@ -485,6 +488,6 @@ pub struct RoutingAlgorithmId {
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct RoutingLinkWrapper {
pub profile_id: String,
pub profile_id: common_utils::id_type::ProfileId,
pub algorithm_id: RoutingAlgorithmId,
}