From c774c2ab673030e311188050ff27a6bb6c4b68ed Mon Sep 17 00:00:00 2001 From: Prasunna Soppa Date: Thu, 14 Nov 2024 16:46:47 +0530 Subject: [PATCH 01/17] add call_back_mapper table --- .vscode/launch.json | 1164 +++++++++++++++++ crates/diesel_models/src/call_back_mapper.rs | 28 + crates/diesel_models/src/lib.rs | 1 + crates/diesel_models/src/query.rs | 1 + .../src/query/call_back_mapper.rs | 30 + crates/diesel_models/src/schema.rs | 17 + crates/router/src/db.rs | 1 + crates/router/src/db/call_back_mapper.rs | 53 + crates/router/src/types/storage.rs | 3 +- .../src/types/storage/call_back_mapper.rs | 1 + .../down.sql | 2 + .../up.sql | 8 + 12 files changed, 1308 insertions(+), 1 deletion(-) create mode 100644 .vscode/launch.json create mode 100644 crates/diesel_models/src/call_back_mapper.rs create mode 100644 crates/diesel_models/src/query/call_back_mapper.rs create mode 100644 crates/router/src/db/call_back_mapper.rs create mode 100644 crates/router/src/types/storage/call_back_mapper.rs create mode 100644 migrations/2024-11-13-105952_add_call-back-mapper_table/down.sql create mode 100644 migrations/2024-11-13-105952_add_call-back-mapper_table/up.sql diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000000..f9d240c2e4c5 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,1164 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'analytics'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=analytics" + ], + "filter": { + "name": "analytics", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'api_models'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=api_models" + ], + "filter": { + "name": "api_models", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'cards'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=cards" + ], + "filter": { + "name": "cards", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug integration test 'basic'", + "cargo": { + "args": [ + "test", + "--no-run", + "--test=basic", + "--package=cards" + ], + "filter": { + "name": "basic", + "kind": "test" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'common_utils'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=common_utils" + ], + "filter": { + "name": "common_utils", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug integration test 'percentage'", + "cargo": { + "args": [ + "test", + "--no-run", + "--test=percentage", + "--package=common_utils" + ], + "filter": { + "name": "percentage", + "kind": "test" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'common_enums'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=common_enums" + ], + "filter": { + "name": "common_enums", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'masking'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=masking" + ], + "filter": { + "name": "masking", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug integration test 'basic'", + "cargo": { + "args": [ + "test", + "--no-run", + "--test=basic", + "--package=masking" + ], + "filter": { + "name": "basic", + "kind": "test" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'router_env'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=router_env" + ], + "filter": { + "name": "router_env", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug integration test 'env'", + "cargo": { + "args": [ + "test", + "--no-run", + "--test=env", + "--package=router_env" + ], + "filter": { + "name": "env", + "kind": "test" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug integration test 'logger'", + "cargo": { + "args": [ + "test", + "--no-run", + "--test=logger", + "--package=router_env" + ], + "filter": { + "name": "logger", + "kind": "test" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'euclid'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=euclid" + ], + "filter": { + "name": "euclid", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug benchmark 'backends'", + "cargo": { + "args": [ + "test", + "--no-run", + "--bench=backends", + "--package=euclid" + ], + "filter": { + "name": "backends", + "kind": "bench" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'hyperswitch_constraint_graph'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=hyperswitch_constraint_graph" + ], + "filter": { + "name": "hyperswitch_constraint_graph", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'diesel_models'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=diesel_models" + ], + "filter": { + "name": "diesel_models", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'hyperswitch_domain_models'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=hyperswitch_domain_models" + ], + "filter": { + "name": "hyperswitch_domain_models", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'hyperswitch_interfaces'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=hyperswitch_interfaces" + ], + "filter": { + "name": "hyperswitch_interfaces", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'storage_impl'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=storage_impl" + ], + "filter": { + "name": "storage_impl", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'redis_interface'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=redis_interface" + ], + "filter": { + "name": "redis_interface", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug executable 'config_importer'", + "cargo": { + "args": [ + "build", + "--bin=config_importer", + "--package=config_importer" + ], + "filter": { + "name": "config_importer", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in executable 'config_importer'", + "cargo": { + "args": [ + "test", + "--no-run", + "--bin=config_importer", + "--package=config_importer" + ], + "filter": { + "name": "config_importer", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'connector_configs'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=connector_configs" + ], + "filter": { + "name": "connector_configs", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'currency_conversion'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=currency_conversion" + ], + "filter": { + "name": "currency_conversion", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'drainer'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=drainer" + ], + "filter": { + "name": "drainer", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug executable 'drainer'", + "cargo": { + "args": [ + "build", + "--bin=drainer", + "--package=drainer" + ], + "filter": { + "name": "drainer", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in executable 'drainer'", + "cargo": { + "args": [ + "test", + "--no-run", + "--bin=drainer", + "--package=drainer" + ], + "filter": { + "name": "drainer", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'external_services'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=external_services" + ], + "filter": { + "name": "external_services", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'kgraph_utils'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=kgraph_utils" + ], + "filter": { + "name": "kgraph_utils", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug benchmark 'evaluation'", + "cargo": { + "args": [ + "test", + "--no-run", + "--bench=evaluation", + "--package=kgraph_utils" + ], + "filter": { + "name": "evaluation", + "kind": "bench" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'events'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=events" + ], + "filter": { + "name": "events", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug executable 'hsdev'", + "cargo": { + "args": [ + "build", + "--bin=hsdev", + "--package=hsdev" + ], + "filter": { + "name": "hsdev", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in executable 'hsdev'", + "cargo": { + "args": [ + "test", + "--no-run", + "--bin=hsdev", + "--package=hsdev" + ], + "filter": { + "name": "hsdev", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'hyperswitch_connectors'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=hyperswitch_connectors" + ], + "filter": { + "name": "hyperswitch_connectors", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'openapi'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=openapi" + ], + "filter": { + "name": "openapi", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug executable 'openapi'", + "cargo": { + "args": [ + "build", + "--bin=openapi", + "--package=openapi" + ], + "filter": { + "name": "openapi", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in executable 'openapi'", + "cargo": { + "args": [ + "test", + "--no-run", + "--bin=openapi", + "--package=openapi" + ], + "filter": { + "name": "openapi", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'pm_auth'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=pm_auth" + ], + "filter": { + "name": "pm_auth", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'router'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=router" + ], + "filter": { + "name": "router", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug executable 'router'", + "cargo": { + "args": [ + "build", + "--bin=router", + "--package=router" + ], + "filter": { + "name": "router", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}", + "env":{ + "RUST_MIN_STACK": "10388608" + } + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in executable 'router'", + "cargo": { + "args": [ + "test", + "--no-run", + "--bin=router", + "--package=router" + ], + "filter": { + "name": "router", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug executable 'scheduler'", + "cargo": { + "args": [ + "build", + "--bin=scheduler", + "--package=router" + ], + "filter": { + "name": "scheduler", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in executable 'scheduler'", + "cargo": { + "args": [ + "test", + "--no-run", + "--bin=scheduler", + "--package=router" + ], + "filter": { + "name": "scheduler", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug integration test 'cache'", + "cargo": { + "args": [ + "test", + "--no-run", + "--test=cache", + "--package=router" + ], + "filter": { + "name": "cache", + "kind": "test" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug integration test 'connectors'", + "cargo": { + "args": [ + "test", + "--no-run", + "--test=connectors", + "--package=router" + ], + "filter": { + "name": "connectors", + "kind": "test" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug integration test 'customers'", + "cargo": { + "args": [ + "test", + "--no-run", + "--test=customers", + "--package=router" + ], + "filter": { + "name": "customers", + "kind": "test" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug integration test 'health_check'", + "cargo": { + "args": [ + "test", + "--no-run", + "--test=health_check", + "--package=router" + ], + "filter": { + "name": "health_check", + "kind": "test" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug integration test 'integration_demo'", + "cargo": { + "args": [ + "test", + "--no-run", + "--test=integration_demo", + "--package=router" + ], + "filter": { + "name": "integration_demo", + "kind": "test" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug integration test 'macros'", + "cargo": { + "args": [ + "test", + "--no-run", + "--test=macros", + "--package=router" + ], + "filter": { + "name": "macros", + "kind": "test" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug integration test 'payments'", + "cargo": { + "args": [ + "test", + "--no-run", + "--test=payments", + "--package=router" + ], + "filter": { + "name": "payments", + "kind": "test" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug integration test 'payments2'", + "cargo": { + "args": [ + "test", + "--no-run", + "--test=payments2", + "--package=router" + ], + "filter": { + "name": "payments2", + "kind": "test" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug integration test 'payouts'", + "cargo": { + "args": [ + "test", + "--no-run", + "--test=payouts", + "--package=router" + ], + "filter": { + "name": "payouts", + "kind": "test" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug integration test 'refunds'", + "cargo": { + "args": [ + "test", + "--no-run", + "--test=refunds", + "--package=router" + ], + "filter": { + "name": "refunds", + "kind": "test" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug integration test 'services'", + "cargo": { + "args": [ + "test", + "--no-run", + "--test=services", + "--package=router" + ], + "filter": { + "name": "services", + "kind": "test" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug integration test 'utils'", + "cargo": { + "args": [ + "test", + "--no-run", + "--test=utils", + "--package=router" + ], + "filter": { + "name": "utils", + "kind": "test" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug integration test 'webhooks'", + "cargo": { + "args": [ + "test", + "--no-run", + "--test=webhooks", + "--package=router" + ], + "filter": { + "name": "webhooks", + "kind": "test" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'scheduler'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=scheduler" + ], + "filter": { + "name": "scheduler", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'test_utils'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=test_utils" + ], + "filter": { + "name": "test_utils", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug executable 'test_utils'", + "cargo": { + "args": [ + "build", + "--bin=test_utils", + "--package=test_utils" + ], + "filter": { + "name": "test_utils", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in executable 'test_utils'", + "cargo": { + "args": [ + "test", + "--no-run", + "--bin=test_utils", + "--package=test_utils" + ], + "filter": { + "name": "test_utils", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug integration test 'connectors'", + "cargo": { + "args": [ + "test", + "--no-run", + "--test=connectors", + "--package=test_utils" + ], + "filter": { + "name": "connectors", + "kind": "test" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + } + ] +} \ No newline at end of file diff --git a/crates/diesel_models/src/call_back_mapper.rs b/crates/diesel_models/src/call_back_mapper.rs new file mode 100644 index 000000000000..10e7f264cf81 --- /dev/null +++ b/crates/diesel_models/src/call_back_mapper.rs @@ -0,0 +1,28 @@ +use diesel::{ Identifiable, Insertable, Queryable, Selectable}; +use serde::{self, Deserialize, Serialize}; +use serde_json; + +use crate::schema::call_back_mapper; + +#[derive( + Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Serialize, Deserialize, +)] +#[diesel(table_name = call_back_mapper, primary_key(id), check_for_backend(diesel::pg::Pg))] + +pub struct CallBackMapper { + pub id: String, + #[serde(rename = "type")] + pub id_type: String, + pub data: serde_json::Value, + pub created_at: time::PrimitiveDateTime, + pub last_modified_at: time::PrimitiveDateTime, +} + +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize, Insertable)] +#[diesel(table_name = call_back_mapper)] +pub struct CallBackMapperNew{ + pub id: String, + #[serde(rename = "type")] + pub id_type: String, + pub data: serde_json::Value, +} \ No newline at end of file diff --git a/crates/diesel_models/src/lib.rs b/crates/diesel_models/src/lib.rs index c7a3818d5fea..a444567cd13d 100644 --- a/crates/diesel_models/src/lib.rs +++ b/crates/diesel_models/src/lib.rs @@ -43,6 +43,7 @@ pub mod role; pub mod routing_algorithm; pub mod types; pub mod unified_translations; +pub mod call_back_mapper; #[allow(unused_qualifications)] pub mod schema; diff --git a/crates/diesel_models/src/query.rs b/crates/diesel_models/src/query.rs index f966e90acba9..4d2f38e1637e 100644 --- a/crates/diesel_models/src/query.rs +++ b/crates/diesel_models/src/query.rs @@ -41,3 +41,4 @@ pub mod user; pub mod user_authentication_method; pub mod user_key_store; pub mod user_role; +pub mod call_back_mapper; \ No newline at end of file diff --git a/crates/diesel_models/src/query/call_back_mapper.rs b/crates/diesel_models/src/query/call_back_mapper.rs new file mode 100644 index 000000000000..fc4ce5c324f2 --- /dev/null +++ b/crates/diesel_models/src/query/call_back_mapper.rs @@ -0,0 +1,30 @@ +use diesel::{associations::HasTable, ExpressionMethods}; + +use super::generics; +use crate::{ + call_back_mapper::{ + CallBackMapper, CallBackMapperNew, + }, + schema::call_back_mapper::dsl, + PgPooledConn, StorageResult, +}; + +impl CallBackMapperNew{ + pub async fn insert(self, conn: &PgPooledConn) -> StorageResult { + generics::generic_insert(conn, self).await + } +} + +impl CallBackMapper{ + pub async fn find_by_id( + conn: &PgPooledConn, + id: String, + ) -> StorageResult { + generics::generic_find_one::<::Table, _, _>( + conn, + dsl::id + .eq(id.to_owned()) + ) + .await + } +} \ No newline at end of file diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs index 782d7f50eac2..58c3b47591b9 100644 --- a/crates/diesel_models/src/schema.rs +++ b/crates/diesel_models/src/schema.rs @@ -216,6 +216,22 @@ diesel::table! { } } +diesel::table! { + use diesel::sql_types::*; + use crate::enums::diesel_exports::*; + + call_back_mapper (id) { + #[max_length = 128] + id -> Varchar, + #[sql_name = "type"] + #[max_length = 64] + id_type -> Varchar, + data -> Jsonb, + created_at -> Timestamp, + last_modified_at -> Timestamp, + } +} + diesel::table! { use diesel::sql_types::*; use crate::enums::diesel_exports::*; @@ -1379,6 +1395,7 @@ diesel::allow_tables_to_appear_in_same_query!( blocklist_fingerprint, blocklist_lookup, business_profile, + call_back_mapper, captures, cards_info, configs, diff --git a/crates/router/src/db.rs b/crates/router/src/db.rs index de0c6282fc21..c9120e41d32a 100644 --- a/crates/router/src/db.rs +++ b/crates/router/src/db.rs @@ -37,6 +37,7 @@ pub mod user; pub mod user_authentication_method; pub mod user_key_store; pub mod user_role; +pub mod call_back_mapper; use common_utils::id_type; use diesel_models::{ fraud_check::{FraudCheck, FraudCheckUpdate}, diff --git a/crates/router/src/db/call_back_mapper.rs b/crates/router/src/db/call_back_mapper.rs new file mode 100644 index 000000000000..2ef2f08c1f8d --- /dev/null +++ b/crates/router/src/db/call_back_mapper.rs @@ -0,0 +1,53 @@ +use error_stack::report; +// use diesel_models::call_back_mapper; +use router_env::{instrument, tracing}; + +use super::Store; +use crate::{ + connection, + core::errors::{self, CustomResult}, + types::storage, +}; + +#[async_trait::async_trait] +pub trait CallBackMapperInterface { + async fn insert_call_back_mapper( + &self, + call_back_mapper: storage::CallBackMapperNew, + ) -> CustomResult; + + async fn find_call_back_mapper_by_id( + &self, + id: String, + ) -> CustomResult; +} + +#[async_trait::async_trait] +impl CallBackMapperInterface for Store { + #[instrument(skip_all)] + async fn insert_call_back_mapper( + &self, + call_back_mapper: storage::CallBackMapperNew, + ) -> CustomResult{ + let conn = connection::pg_connection_write(self).await?; + call_back_mapper + .insert(&conn) + .await + .map_err(|error| report!(errors::StorageError::from(error))) + } + + async fn find_call_back_mapper_by_id( + &self, + id: String, + ) -> CustomResult{ + let conn = connection::pg_connection_read(self).await?; + storage::CallBackMapper::find_by_id( + &conn, + id, + ) + .await + .map_err(|error| report!(errors::StorageError::from(error))) + + } + +} \ No newline at end of file diff --git a/crates/router/src/types/storage.rs b/crates/router/src/types/storage.rs index 41ece363b4f8..d5d8e82729e7 100644 --- a/crates/router/src/types/storage.rs +++ b/crates/router/src/types/storage.rs @@ -39,6 +39,7 @@ pub mod unified_translations; pub mod user; pub mod user_authentication_method; pub mod user_role; +pub mod call_back_mapper; use std::collections::HashMap; @@ -68,7 +69,7 @@ pub use self::{ merchant_account::*, merchant_connector_account::*, merchant_key_store::*, payment_link::*, payment_method::*, process_tracker::*, refund::*, reverse_lookup::*, role::*, routing_algorithm::*, unified_translations::*, user::*, user_authentication_method::*, - user_role::*, + user_role::*, call_back_mapper::*, }; use crate::types::api::routing; diff --git a/crates/router/src/types/storage/call_back_mapper.rs b/crates/router/src/types/storage/call_back_mapper.rs new file mode 100644 index 000000000000..542a79ffa09e --- /dev/null +++ b/crates/router/src/types/storage/call_back_mapper.rs @@ -0,0 +1 @@ +pub use diesel_models::call_back_mapper::{CallBackMapper, CallBackMapperNew}; diff --git a/migrations/2024-11-13-105952_add_call-back-mapper_table/down.sql b/migrations/2024-11-13-105952_add_call-back-mapper_table/down.sql new file mode 100644 index 000000000000..7a285def8545 --- /dev/null +++ b/migrations/2024-11-13-105952_add_call-back-mapper_table/down.sql @@ -0,0 +1,2 @@ +-- This file should undo anything in `up.sql` +DROP TABLE IF EXISTS call_back_mapper; \ No newline at end of file diff --git a/migrations/2024-11-13-105952_add_call-back-mapper_table/up.sql b/migrations/2024-11-13-105952_add_call-back-mapper_table/up.sql new file mode 100644 index 000000000000..602dfd0b59e8 --- /dev/null +++ b/migrations/2024-11-13-105952_add_call-back-mapper_table/up.sql @@ -0,0 +1,8 @@ +-- Your SQL goes here +CREATE TABLE IF NOT EXISTS call_back_mapper ( + id VARCHAR(128) NOT NULL PRIMARY KEY, + type VARCHAR(64) NOT NULL, + data JSONB NOT NULL, + created_at TIMESTAMP NOT NULL DEFAULT now()::TIMESTAMP, + last_modified_at TIMESTAMP NOT NULL DEFAULT now()::TIMESTAMP +); \ No newline at end of file From c41e0628b8af4e2a1f9ec999c17c29b213258db1 Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 11:27:26 +0000 Subject: [PATCH 02/17] chore: run formatter --- crates/diesel_models/src/call_back_mapper.rs | 6 +++--- crates/diesel_models/src/lib.rs | 2 +- crates/diesel_models/src/query.rs | 2 +- .../src/query/call_back_mapper.rs | 18 ++++++------------ crates/router/src/db.rs | 2 +- crates/router/src/db/call_back_mapper.rs | 17 ++++++----------- crates/router/src/types/storage.rs | 16 ++++++++-------- 7 files changed, 26 insertions(+), 37 deletions(-) diff --git a/crates/diesel_models/src/call_back_mapper.rs b/crates/diesel_models/src/call_back_mapper.rs index 10e7f264cf81..25c2f3d0ecff 100644 --- a/crates/diesel_models/src/call_back_mapper.rs +++ b/crates/diesel_models/src/call_back_mapper.rs @@ -1,4 +1,4 @@ -use diesel::{ Identifiable, Insertable, Queryable, Selectable}; +use diesel::{Identifiable, Insertable, Queryable, Selectable}; use serde::{self, Deserialize, Serialize}; use serde_json; @@ -20,9 +20,9 @@ pub struct CallBackMapper { #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize, Insertable)] #[diesel(table_name = call_back_mapper)] -pub struct CallBackMapperNew{ +pub struct CallBackMapperNew { pub id: String, #[serde(rename = "type")] pub id_type: String, pub data: serde_json::Value, -} \ No newline at end of file +} diff --git a/crates/diesel_models/src/lib.rs b/crates/diesel_models/src/lib.rs index a444567cd13d..9ff310dcf265 100644 --- a/crates/diesel_models/src/lib.rs +++ b/crates/diesel_models/src/lib.rs @@ -10,6 +10,7 @@ pub mod authentication; pub mod authorization; pub mod blocklist; pub mod blocklist_fingerprint; +pub mod call_back_mapper; pub mod customers; pub mod dispute; pub mod enums; @@ -43,7 +44,6 @@ pub mod role; pub mod routing_algorithm; pub mod types; pub mod unified_translations; -pub mod call_back_mapper; #[allow(unused_qualifications)] pub mod schema; diff --git a/crates/diesel_models/src/query.rs b/crates/diesel_models/src/query.rs index 4d2f38e1637e..070660a041c9 100644 --- a/crates/diesel_models/src/query.rs +++ b/crates/diesel_models/src/query.rs @@ -10,6 +10,7 @@ pub mod authentication; pub mod authorization; pub mod blocklist; pub mod blocklist_fingerprint; +pub mod call_back_mapper; pub mod customers; pub mod dashboard_metadata; pub mod dispute; @@ -41,4 +42,3 @@ pub mod user; pub mod user_authentication_method; pub mod user_key_store; pub mod user_role; -pub mod call_back_mapper; \ No newline at end of file diff --git a/crates/diesel_models/src/query/call_back_mapper.rs b/crates/diesel_models/src/query/call_back_mapper.rs index fc4ce5c324f2..72f11089629f 100644 --- a/crates/diesel_models/src/query/call_back_mapper.rs +++ b/crates/diesel_models/src/query/call_back_mapper.rs @@ -2,29 +2,23 @@ use diesel::{associations::HasTable, ExpressionMethods}; use super::generics; use crate::{ - call_back_mapper::{ - CallBackMapper, CallBackMapperNew, - }, + call_back_mapper::{CallBackMapper, CallBackMapperNew}, schema::call_back_mapper::dsl, PgPooledConn, StorageResult, }; -impl CallBackMapperNew{ +impl CallBackMapperNew { pub async fn insert(self, conn: &PgPooledConn) -> StorageResult { generics::generic_insert(conn, self).await } } -impl CallBackMapper{ - pub async fn find_by_id( - conn: &PgPooledConn, - id: String, - ) -> StorageResult { +impl CallBackMapper { + pub async fn find_by_id(conn: &PgPooledConn, id: String) -> StorageResult { generics::generic_find_one::<::Table, _, _>( conn, - dsl::id - .eq(id.to_owned()) + dsl::id.eq(id.to_owned()), ) .await } -} \ No newline at end of file +} diff --git a/crates/router/src/db.rs b/crates/router/src/db.rs index c9120e41d32a..1452091d623c 100644 --- a/crates/router/src/db.rs +++ b/crates/router/src/db.rs @@ -6,6 +6,7 @@ pub mod blocklist; pub mod blocklist_fingerprint; pub mod blocklist_lookup; pub mod business_profile; +pub mod call_back_mapper; pub mod capture; pub mod cards_info; pub mod configs; @@ -37,7 +38,6 @@ pub mod user; pub mod user_authentication_method; pub mod user_key_store; pub mod user_role; -pub mod call_back_mapper; use common_utils::id_type; use diesel_models::{ fraud_check::{FraudCheck, FraudCheckUpdate}, diff --git a/crates/router/src/db/call_back_mapper.rs b/crates/router/src/db/call_back_mapper.rs index 2ef2f08c1f8d..45e0897749df 100644 --- a/crates/router/src/db/call_back_mapper.rs +++ b/crates/router/src/db/call_back_mapper.rs @@ -28,7 +28,7 @@ impl CallBackMapperInterface for Store { async fn insert_call_back_mapper( &self, call_back_mapper: storage::CallBackMapperNew, - ) -> CustomResult{ + ) -> CustomResult { let conn = connection::pg_connection_write(self).await?; call_back_mapper .insert(&conn) @@ -39,15 +39,10 @@ impl CallBackMapperInterface for Store { async fn find_call_back_mapper_by_id( &self, id: String, - ) -> CustomResult{ + ) -> CustomResult { let conn = connection::pg_connection_read(self).await?; - storage::CallBackMapper::find_by_id( - &conn, - id, - ) - .await - .map_err(|error| report!(errors::StorageError::from(error))) - + storage::CallBackMapper::find_by_id(&conn, id) + .await + .map_err(|error| report!(errors::StorageError::from(error))) } - -} \ No newline at end of file +} diff --git a/crates/router/src/types/storage.rs b/crates/router/src/types/storage.rs index d5d8e82729e7..3d9af071d0d9 100644 --- a/crates/router/src/types/storage.rs +++ b/crates/router/src/types/storage.rs @@ -6,6 +6,7 @@ pub mod blocklist; pub mod blocklist_fingerprint; pub mod blocklist_lookup; pub mod business_profile; +pub mod call_back_mapper; pub mod capture; pub mod cards_info; pub mod configs; @@ -39,7 +40,6 @@ pub mod unified_translations; pub mod user; pub mod user_authentication_method; pub mod user_role; -pub mod call_back_mapper; use std::collections::HashMap; @@ -63,13 +63,13 @@ pub use scheduler::db::process_tracker; pub use self::{ address::*, api_keys::*, authentication::*, authorization::*, blocklist::*, - blocklist_fingerprint::*, blocklist_lookup::*, business_profile::*, capture::*, cards_info::*, - configs::*, customers::*, dashboard_metadata::*, dispute::*, ephemeral_key::*, events::*, - file::*, fraud_check::*, generic_link::*, gsm::*, locker_mock_up::*, mandate::*, - merchant_account::*, merchant_connector_account::*, merchant_key_store::*, payment_link::*, - payment_method::*, process_tracker::*, refund::*, reverse_lookup::*, role::*, - routing_algorithm::*, unified_translations::*, user::*, user_authentication_method::*, - user_role::*, call_back_mapper::*, + blocklist_fingerprint::*, blocklist_lookup::*, business_profile::*, call_back_mapper::*, + capture::*, cards_info::*, configs::*, customers::*, dashboard_metadata::*, dispute::*, + ephemeral_key::*, events::*, file::*, fraud_check::*, generic_link::*, gsm::*, + locker_mock_up::*, mandate::*, merchant_account::*, merchant_connector_account::*, + merchant_key_store::*, payment_link::*, payment_method::*, process_tracker::*, refund::*, + reverse_lookup::*, role::*, routing_algorithm::*, unified_translations::*, user::*, + user_authentication_method::*, user_role::*, }; use crate::types::api::routing; From e3ed4a7c24ecbff86b4b8814c2359a90bf578ceb Mon Sep 17 00:00:00 2001 From: Prasunna Soppa Date: Thu, 14 Nov 2024 16:57:37 +0530 Subject: [PATCH 03/17] remove launch json --- .vscode/launch.json | 1164 ------------------------------------------- 1 file changed, 1164 deletions(-) delete mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index f9d240c2e4c5..000000000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,1164 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'analytics'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=analytics" - ], - "filter": { - "name": "analytics", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'api_models'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=api_models" - ], - "filter": { - "name": "api_models", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'cards'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=cards" - ], - "filter": { - "name": "cards", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug integration test 'basic'", - "cargo": { - "args": [ - "test", - "--no-run", - "--test=basic", - "--package=cards" - ], - "filter": { - "name": "basic", - "kind": "test" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'common_utils'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=common_utils" - ], - "filter": { - "name": "common_utils", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug integration test 'percentage'", - "cargo": { - "args": [ - "test", - "--no-run", - "--test=percentage", - "--package=common_utils" - ], - "filter": { - "name": "percentage", - "kind": "test" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'common_enums'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=common_enums" - ], - "filter": { - "name": "common_enums", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'masking'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=masking" - ], - "filter": { - "name": "masking", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug integration test 'basic'", - "cargo": { - "args": [ - "test", - "--no-run", - "--test=basic", - "--package=masking" - ], - "filter": { - "name": "basic", - "kind": "test" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'router_env'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=router_env" - ], - "filter": { - "name": "router_env", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug integration test 'env'", - "cargo": { - "args": [ - "test", - "--no-run", - "--test=env", - "--package=router_env" - ], - "filter": { - "name": "env", - "kind": "test" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug integration test 'logger'", - "cargo": { - "args": [ - "test", - "--no-run", - "--test=logger", - "--package=router_env" - ], - "filter": { - "name": "logger", - "kind": "test" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'euclid'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=euclid" - ], - "filter": { - "name": "euclid", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug benchmark 'backends'", - "cargo": { - "args": [ - "test", - "--no-run", - "--bench=backends", - "--package=euclid" - ], - "filter": { - "name": "backends", - "kind": "bench" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'hyperswitch_constraint_graph'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=hyperswitch_constraint_graph" - ], - "filter": { - "name": "hyperswitch_constraint_graph", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'diesel_models'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=diesel_models" - ], - "filter": { - "name": "diesel_models", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'hyperswitch_domain_models'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=hyperswitch_domain_models" - ], - "filter": { - "name": "hyperswitch_domain_models", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'hyperswitch_interfaces'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=hyperswitch_interfaces" - ], - "filter": { - "name": "hyperswitch_interfaces", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'storage_impl'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=storage_impl" - ], - "filter": { - "name": "storage_impl", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'redis_interface'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=redis_interface" - ], - "filter": { - "name": "redis_interface", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'config_importer'", - "cargo": { - "args": [ - "build", - "--bin=config_importer", - "--package=config_importer" - ], - "filter": { - "name": "config_importer", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in executable 'config_importer'", - "cargo": { - "args": [ - "test", - "--no-run", - "--bin=config_importer", - "--package=config_importer" - ], - "filter": { - "name": "config_importer", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'connector_configs'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=connector_configs" - ], - "filter": { - "name": "connector_configs", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'currency_conversion'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=currency_conversion" - ], - "filter": { - "name": "currency_conversion", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'drainer'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=drainer" - ], - "filter": { - "name": "drainer", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'drainer'", - "cargo": { - "args": [ - "build", - "--bin=drainer", - "--package=drainer" - ], - "filter": { - "name": "drainer", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in executable 'drainer'", - "cargo": { - "args": [ - "test", - "--no-run", - "--bin=drainer", - "--package=drainer" - ], - "filter": { - "name": "drainer", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'external_services'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=external_services" - ], - "filter": { - "name": "external_services", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'kgraph_utils'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=kgraph_utils" - ], - "filter": { - "name": "kgraph_utils", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug benchmark 'evaluation'", - "cargo": { - "args": [ - "test", - "--no-run", - "--bench=evaluation", - "--package=kgraph_utils" - ], - "filter": { - "name": "evaluation", - "kind": "bench" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'events'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=events" - ], - "filter": { - "name": "events", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'hsdev'", - "cargo": { - "args": [ - "build", - "--bin=hsdev", - "--package=hsdev" - ], - "filter": { - "name": "hsdev", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in executable 'hsdev'", - "cargo": { - "args": [ - "test", - "--no-run", - "--bin=hsdev", - "--package=hsdev" - ], - "filter": { - "name": "hsdev", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'hyperswitch_connectors'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=hyperswitch_connectors" - ], - "filter": { - "name": "hyperswitch_connectors", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'openapi'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=openapi" - ], - "filter": { - "name": "openapi", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'openapi'", - "cargo": { - "args": [ - "build", - "--bin=openapi", - "--package=openapi" - ], - "filter": { - "name": "openapi", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in executable 'openapi'", - "cargo": { - "args": [ - "test", - "--no-run", - "--bin=openapi", - "--package=openapi" - ], - "filter": { - "name": "openapi", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'pm_auth'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=pm_auth" - ], - "filter": { - "name": "pm_auth", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'router'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=router" - ], - "filter": { - "name": "router", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'router'", - "cargo": { - "args": [ - "build", - "--bin=router", - "--package=router" - ], - "filter": { - "name": "router", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}", - "env":{ - "RUST_MIN_STACK": "10388608" - } - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in executable 'router'", - "cargo": { - "args": [ - "test", - "--no-run", - "--bin=router", - "--package=router" - ], - "filter": { - "name": "router", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'scheduler'", - "cargo": { - "args": [ - "build", - "--bin=scheduler", - "--package=router" - ], - "filter": { - "name": "scheduler", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in executable 'scheduler'", - "cargo": { - "args": [ - "test", - "--no-run", - "--bin=scheduler", - "--package=router" - ], - "filter": { - "name": "scheduler", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug integration test 'cache'", - "cargo": { - "args": [ - "test", - "--no-run", - "--test=cache", - "--package=router" - ], - "filter": { - "name": "cache", - "kind": "test" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug integration test 'connectors'", - "cargo": { - "args": [ - "test", - "--no-run", - "--test=connectors", - "--package=router" - ], - "filter": { - "name": "connectors", - "kind": "test" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug integration test 'customers'", - "cargo": { - "args": [ - "test", - "--no-run", - "--test=customers", - "--package=router" - ], - "filter": { - "name": "customers", - "kind": "test" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug integration test 'health_check'", - "cargo": { - "args": [ - "test", - "--no-run", - "--test=health_check", - "--package=router" - ], - "filter": { - "name": "health_check", - "kind": "test" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug integration test 'integration_demo'", - "cargo": { - "args": [ - "test", - "--no-run", - "--test=integration_demo", - "--package=router" - ], - "filter": { - "name": "integration_demo", - "kind": "test" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug integration test 'macros'", - "cargo": { - "args": [ - "test", - "--no-run", - "--test=macros", - "--package=router" - ], - "filter": { - "name": "macros", - "kind": "test" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug integration test 'payments'", - "cargo": { - "args": [ - "test", - "--no-run", - "--test=payments", - "--package=router" - ], - "filter": { - "name": "payments", - "kind": "test" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug integration test 'payments2'", - "cargo": { - "args": [ - "test", - "--no-run", - "--test=payments2", - "--package=router" - ], - "filter": { - "name": "payments2", - "kind": "test" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug integration test 'payouts'", - "cargo": { - "args": [ - "test", - "--no-run", - "--test=payouts", - "--package=router" - ], - "filter": { - "name": "payouts", - "kind": "test" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug integration test 'refunds'", - "cargo": { - "args": [ - "test", - "--no-run", - "--test=refunds", - "--package=router" - ], - "filter": { - "name": "refunds", - "kind": "test" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug integration test 'services'", - "cargo": { - "args": [ - "test", - "--no-run", - "--test=services", - "--package=router" - ], - "filter": { - "name": "services", - "kind": "test" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug integration test 'utils'", - "cargo": { - "args": [ - "test", - "--no-run", - "--test=utils", - "--package=router" - ], - "filter": { - "name": "utils", - "kind": "test" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug integration test 'webhooks'", - "cargo": { - "args": [ - "test", - "--no-run", - "--test=webhooks", - "--package=router" - ], - "filter": { - "name": "webhooks", - "kind": "test" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'scheduler'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=scheduler" - ], - "filter": { - "name": "scheduler", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'test_utils'", - "cargo": { - "args": [ - "test", - "--no-run", - "--lib", - "--package=test_utils" - ], - "filter": { - "name": "test_utils", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug executable 'test_utils'", - "cargo": { - "args": [ - "build", - "--bin=test_utils", - "--package=test_utils" - ], - "filter": { - "name": "test_utils", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in executable 'test_utils'", - "cargo": { - "args": [ - "test", - "--no-run", - "--bin=test_utils", - "--package=test_utils" - ], - "filter": { - "name": "test_utils", - "kind": "bin" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - }, - { - "type": "lldb", - "request": "launch", - "name": "Debug integration test 'connectors'", - "cargo": { - "args": [ - "test", - "--no-run", - "--test=connectors", - "--package=test_utils" - ], - "filter": { - "name": "connectors", - "kind": "test" - } - }, - "args": [], - "cwd": "${workspaceFolder}" - } - ] -} \ No newline at end of file From baf137e6c59f086db8a0486b9b7607e8403efdf0 Mon Sep 17 00:00:00 2001 From: Prasunna Soppa Date: Thu, 14 Nov 2024 19:00:10 +0530 Subject: [PATCH 04/17] fix migration check --- crates/diesel_models/src/schema.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs index 2755961d9d09..8ac9aebb8e44 100644 --- a/crates/diesel_models/src/schema.rs +++ b/crates/diesel_models/src/schema.rs @@ -225,7 +225,7 @@ diesel::table! { id -> Varchar, #[sql_name = "type"] #[max_length = 64] - id_type -> Varchar, + type_ -> Varchar, data -> Jsonb, created_at -> Timestamp, last_modified_at -> Timestamp, From df0e757a35c9f7ebc4c6b1b82ac1ee91f93a771a Mon Sep 17 00:00:00 2001 From: Prasunna Soppa Date: Thu, 14 Nov 2024 22:09:07 +0530 Subject: [PATCH 05/17] fix migration check --- crates/diesel_models/src/call_back_mapper.rs | 4 ++-- crates/diesel_models/src/schema_v2.rs | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/crates/diesel_models/src/call_back_mapper.rs b/crates/diesel_models/src/call_back_mapper.rs index 25c2f3d0ecff..6eb6dca1d95c 100644 --- a/crates/diesel_models/src/call_back_mapper.rs +++ b/crates/diesel_models/src/call_back_mapper.rs @@ -12,7 +12,7 @@ use crate::schema::call_back_mapper; pub struct CallBackMapper { pub id: String, #[serde(rename = "type")] - pub id_type: String, + pub type_: String, pub data: serde_json::Value, pub created_at: time::PrimitiveDateTime, pub last_modified_at: time::PrimitiveDateTime, @@ -23,6 +23,6 @@ pub struct CallBackMapper { pub struct CallBackMapperNew { pub id: String, #[serde(rename = "type")] - pub id_type: String, + pub type_: String, pub data: serde_json::Value, } diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs index e3097f80db91..700813276c1d 100644 --- a/crates/diesel_models/src/schema_v2.rs +++ b/crates/diesel_models/src/schema_v2.rs @@ -224,6 +224,22 @@ diesel::table! { } } +diesel::table! { + use diesel::sql_types::*; + use crate::enums::diesel_exports::*; + + call_back_mapper (id) { + #[max_length = 128] + id -> Varchar, + #[sql_name = "type"] + #[max_length = 64] + type_ -> Varchar, + data -> Jsonb, + created_at -> Timestamp, + last_modified_at -> Timestamp, + } +} + diesel::table! { use diesel::sql_types::*; use crate::enums::diesel_exports::*; @@ -1346,6 +1362,7 @@ diesel::allow_tables_to_appear_in_same_query!( blocklist_fingerprint, blocklist_lookup, business_profile, + call_back_mapper, captures, cards_info, configs, From c5b7164ede3d02561dac9892bc9e3447a46a6811 Mon Sep 17 00:00:00 2001 From: Prasunna Soppa Date: Fri, 15 Nov 2024 11:39:16 +0530 Subject: [PATCH 06/17] resolve pr comments --- .../src/{call_back_mapper.rs => callback_mapper.rs} | 8 ++++---- crates/diesel_models/src/lib.rs | 2 +- crates/diesel_models/src/query.rs | 2 +- .../src/query/{call_back_mapper.rs => callback_mapper.rs} | 4 ++-- crates/diesel_models/src/schema.rs | 4 ++-- crates/diesel_models/src/schema_v2.rs | 4 ++-- crates/router/src/db.rs | 2 +- .../src/db/{call_back_mapper.rs => callback_mapper.rs} | 1 - crates/router/src/types/storage.rs | 4 ++-- crates/router/src/types/storage/call_back_mapper.rs | 1 - crates/router/src/types/storage/callback_mapper.rs | 1 + .../2024-11-13-105952_add_call-back-mapper_table/down.sql | 2 +- .../2024-11-13-105952_add_call-back-mapper_table/up.sql | 2 +- 13 files changed, 18 insertions(+), 19 deletions(-) rename crates/diesel_models/src/{call_back_mapper.rs => callback_mapper.rs} (79%) rename crates/diesel_models/src/query/{call_back_mapper.rs => callback_mapper.rs} (85%) rename crates/router/src/db/{call_back_mapper.rs => callback_mapper.rs} (97%) delete mode 100644 crates/router/src/types/storage/call_back_mapper.rs create mode 100644 crates/router/src/types/storage/callback_mapper.rs diff --git a/crates/diesel_models/src/call_back_mapper.rs b/crates/diesel_models/src/callback_mapper.rs similarity index 79% rename from crates/diesel_models/src/call_back_mapper.rs rename to crates/diesel_models/src/callback_mapper.rs index 6eb6dca1d95c..68a79bc0dcc3 100644 --- a/crates/diesel_models/src/call_back_mapper.rs +++ b/crates/diesel_models/src/callback_mapper.rs @@ -2,12 +2,12 @@ use diesel::{Identifiable, Insertable, Queryable, Selectable}; use serde::{self, Deserialize, Serialize}; use serde_json; -use crate::schema::call_back_mapper; +use crate::schema::callback_mapper; #[derive( Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Serialize, Deserialize, )] -#[diesel(table_name = call_back_mapper, primary_key(id), check_for_backend(diesel::pg::Pg))] +#[diesel(table_name = callback_mapper, primary_key(id), check_for_backend(diesel::pg::Pg))] pub struct CallBackMapper { pub id: String, @@ -19,10 +19,10 @@ pub struct CallBackMapper { } #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize, Insertable)] -#[diesel(table_name = call_back_mapper)] +#[diesel(table_name = callback_mapper)] pub struct CallBackMapperNew { pub id: String, #[serde(rename = "type")] pub type_: String, pub data: serde_json::Value, -} +} \ No newline at end of file diff --git a/crates/diesel_models/src/lib.rs b/crates/diesel_models/src/lib.rs index 9ff310dcf265..4d06a438f477 100644 --- a/crates/diesel_models/src/lib.rs +++ b/crates/diesel_models/src/lib.rs @@ -10,7 +10,7 @@ pub mod authentication; pub mod authorization; pub mod blocklist; pub mod blocklist_fingerprint; -pub mod call_back_mapper; +pub mod callback_mapper; pub mod customers; pub mod dispute; pub mod enums; diff --git a/crates/diesel_models/src/query.rs b/crates/diesel_models/src/query.rs index 070660a041c9..1c786a1fa25d 100644 --- a/crates/diesel_models/src/query.rs +++ b/crates/diesel_models/src/query.rs @@ -10,7 +10,7 @@ pub mod authentication; pub mod authorization; pub mod blocklist; pub mod blocklist_fingerprint; -pub mod call_back_mapper; +pub mod callback_mapper; pub mod customers; pub mod dashboard_metadata; pub mod dispute; diff --git a/crates/diesel_models/src/query/call_back_mapper.rs b/crates/diesel_models/src/query/callback_mapper.rs similarity index 85% rename from crates/diesel_models/src/query/call_back_mapper.rs rename to crates/diesel_models/src/query/callback_mapper.rs index 72f11089629f..1e475f303dbf 100644 --- a/crates/diesel_models/src/query/call_back_mapper.rs +++ b/crates/diesel_models/src/query/callback_mapper.rs @@ -2,8 +2,8 @@ use diesel::{associations::HasTable, ExpressionMethods}; use super::generics; use crate::{ - call_back_mapper::{CallBackMapper, CallBackMapperNew}, - schema::call_back_mapper::dsl, + callback_mapper::{CallBackMapper, CallBackMapperNew}, + schema::callback_mapper::dsl, PgPooledConn, StorageResult, }; diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs index 8ac9aebb8e44..110a4b1ac2fa 100644 --- a/crates/diesel_models/src/schema.rs +++ b/crates/diesel_models/src/schema.rs @@ -220,7 +220,7 @@ diesel::table! { use diesel::sql_types::*; use crate::enums::diesel_exports::*; - call_back_mapper (id) { + callback_mapper (id) { #[max_length = 128] id -> Varchar, #[sql_name = "type"] @@ -1415,7 +1415,7 @@ diesel::allow_tables_to_appear_in_same_query!( blocklist_fingerprint, blocklist_lookup, business_profile, - call_back_mapper, + callback_mapper, captures, cards_info, configs, diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs index 700813276c1d..91b268ab0b87 100644 --- a/crates/diesel_models/src/schema_v2.rs +++ b/crates/diesel_models/src/schema_v2.rs @@ -228,7 +228,7 @@ diesel::table! { use diesel::sql_types::*; use crate::enums::diesel_exports::*; - call_back_mapper (id) { + callback_mapper (id) { #[max_length = 128] id -> Varchar, #[sql_name = "type"] @@ -1362,7 +1362,7 @@ diesel::allow_tables_to_appear_in_same_query!( blocklist_fingerprint, blocklist_lookup, business_profile, - call_back_mapper, + callback_mapper, captures, cards_info, configs, diff --git a/crates/router/src/db.rs b/crates/router/src/db.rs index cf71be5c806c..9cd0f3856a9d 100644 --- a/crates/router/src/db.rs +++ b/crates/router/src/db.rs @@ -6,7 +6,7 @@ pub mod blocklist; pub mod blocklist_fingerprint; pub mod blocklist_lookup; pub mod business_profile; -pub mod call_back_mapper; +pub mod callback_mapper; pub mod capture; pub mod cards_info; pub mod configs; diff --git a/crates/router/src/db/call_back_mapper.rs b/crates/router/src/db/callback_mapper.rs similarity index 97% rename from crates/router/src/db/call_back_mapper.rs rename to crates/router/src/db/callback_mapper.rs index 45e0897749df..9d235a976fa6 100644 --- a/crates/router/src/db/call_back_mapper.rs +++ b/crates/router/src/db/callback_mapper.rs @@ -1,5 +1,4 @@ use error_stack::report; -// use diesel_models::call_back_mapper; use router_env::{instrument, tracing}; use super::Store; diff --git a/crates/router/src/types/storage.rs b/crates/router/src/types/storage.rs index 3d9af071d0d9..2ece861efbe7 100644 --- a/crates/router/src/types/storage.rs +++ b/crates/router/src/types/storage.rs @@ -6,7 +6,7 @@ pub mod blocklist; pub mod blocklist_fingerprint; pub mod blocklist_lookup; pub mod business_profile; -pub mod call_back_mapper; +pub mod callback_mapper; pub mod capture; pub mod cards_info; pub mod configs; @@ -63,7 +63,7 @@ pub use scheduler::db::process_tracker; pub use self::{ address::*, api_keys::*, authentication::*, authorization::*, blocklist::*, - blocklist_fingerprint::*, blocklist_lookup::*, business_profile::*, call_back_mapper::*, + blocklist_fingerprint::*, blocklist_lookup::*, business_profile::*, callback_mapper::*, capture::*, cards_info::*, configs::*, customers::*, dashboard_metadata::*, dispute::*, ephemeral_key::*, events::*, file::*, fraud_check::*, generic_link::*, gsm::*, locker_mock_up::*, mandate::*, merchant_account::*, merchant_connector_account::*, diff --git a/crates/router/src/types/storage/call_back_mapper.rs b/crates/router/src/types/storage/call_back_mapper.rs deleted file mode 100644 index 542a79ffa09e..000000000000 --- a/crates/router/src/types/storage/call_back_mapper.rs +++ /dev/null @@ -1 +0,0 @@ -pub use diesel_models::call_back_mapper::{CallBackMapper, CallBackMapperNew}; diff --git a/crates/router/src/types/storage/callback_mapper.rs b/crates/router/src/types/storage/callback_mapper.rs new file mode 100644 index 000000000000..cc8cc944838f --- /dev/null +++ b/crates/router/src/types/storage/callback_mapper.rs @@ -0,0 +1 @@ +pub use diesel_models::callback_mapper::{CallBackMapper, CallBackMapperNew}; diff --git a/migrations/2024-11-13-105952_add_call-back-mapper_table/down.sql b/migrations/2024-11-13-105952_add_call-back-mapper_table/down.sql index 7a285def8545..8c2f4f54a170 100644 --- a/migrations/2024-11-13-105952_add_call-back-mapper_table/down.sql +++ b/migrations/2024-11-13-105952_add_call-back-mapper_table/down.sql @@ -1,2 +1,2 @@ -- This file should undo anything in `up.sql` -DROP TABLE IF EXISTS call_back_mapper; \ No newline at end of file +DROP TABLE IF EXISTS callback_mapper; \ No newline at end of file diff --git a/migrations/2024-11-13-105952_add_call-back-mapper_table/up.sql b/migrations/2024-11-13-105952_add_call-back-mapper_table/up.sql index 602dfd0b59e8..f9df2c9537d3 100644 --- a/migrations/2024-11-13-105952_add_call-back-mapper_table/up.sql +++ b/migrations/2024-11-13-105952_add_call-back-mapper_table/up.sql @@ -1,5 +1,5 @@ -- Your SQL goes here -CREATE TABLE IF NOT EXISTS call_back_mapper ( +CREATE TABLE IF NOT EXISTS callback_mapper ( id VARCHAR(128) NOT NULL PRIMARY KEY, type VARCHAR(64) NOT NULL, data JSONB NOT NULL, From 75d929bf4e45c1868ded14087b31caa189e41cc9 Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2024 06:10:12 +0000 Subject: [PATCH 07/17] chore: run formatter --- crates/diesel_models/src/callback_mapper.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/diesel_models/src/callback_mapper.rs b/crates/diesel_models/src/callback_mapper.rs index 68a79bc0dcc3..8d660de9a0a4 100644 --- a/crates/diesel_models/src/callback_mapper.rs +++ b/crates/diesel_models/src/callback_mapper.rs @@ -25,4 +25,4 @@ pub struct CallBackMapperNew { #[serde(rename = "type")] pub type_: String, pub data: serde_json::Value, -} \ No newline at end of file +} From 14d20cd149be97eedd75e4e0eaa1c64b41fc4b11 Mon Sep 17 00:00:00 2001 From: Prasunna Soppa Date: Wed, 20 Nov 2024 10:47:45 +0530 Subject: [PATCH 08/17] code refactoring --- crates/diesel_models/src/callback_mapper.rs | 1 - crates/diesel_models/src/lib.rs | 2 +- .../src/callback_mapper.rs | 19 +++++++ crates/hyperswitch_domain_models/src/lib.rs | 1 + crates/router/src/db/callback_mapper.rs | 27 ++++++---- crates/router/src/db/kafka_store.rs | 24 +++++++++ crates/router/src/types/domain.rs | 5 ++ crates/storage_impl/src/callback_mapper.rs | 51 +++++++++++++++++++ crates/storage_impl/src/lib.rs | 1 + 9 files changed, 119 insertions(+), 12 deletions(-) create mode 100644 crates/hyperswitch_domain_models/src/callback_mapper.rs create mode 100644 crates/storage_impl/src/callback_mapper.rs diff --git a/crates/diesel_models/src/callback_mapper.rs b/crates/diesel_models/src/callback_mapper.rs index 68a79bc0dcc3..1103d5186a1c 100644 --- a/crates/diesel_models/src/callback_mapper.rs +++ b/crates/diesel_models/src/callback_mapper.rs @@ -8,7 +8,6 @@ use crate::schema::callback_mapper; Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Serialize, Deserialize, )] #[diesel(table_name = callback_mapper, primary_key(id), check_for_backend(diesel::pg::Pg))] - pub struct CallBackMapper { pub id: String, #[serde(rename = "type")] diff --git a/crates/diesel_models/src/lib.rs b/crates/diesel_models/src/lib.rs index 4d06a438f477..087fb2a4f067 100644 --- a/crates/diesel_models/src/lib.rs +++ b/crates/diesel_models/src/lib.rs @@ -64,7 +64,7 @@ pub use self::{ events::*, file::*, generic_link::*, locker_mock_up::*, mandate::*, merchant_account::*, merchant_connector_account::*, payment_attempt::*, payment_intent::*, payment_method::*, payout_attempt::*, payouts::*, process_tracker::*, refund::*, reverse_lookup::*, - user_authentication_method::*, + user_authentication_method::*, callback_mapper::*, }; /// The types and implementations provided by this module are required for the schema generated by diff --git a/crates/hyperswitch_domain_models/src/callback_mapper.rs b/crates/hyperswitch_domain_models/src/callback_mapper.rs new file mode 100644 index 000000000000..89e8b60454ba --- /dev/null +++ b/crates/hyperswitch_domain_models/src/callback_mapper.rs @@ -0,0 +1,19 @@ +use serde::{self, Deserialize, Serialize}; + +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +pub struct CallBackMapper { + pub id: String, + #[serde(rename = "type")] + pub type_: String, + pub data: serde_json::Value, + pub created_at: time::PrimitiveDateTime, + pub last_modified_at: time::PrimitiveDateTime, +} + +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +pub struct CallBackMapperNew { + pub id: String, + #[serde(rename = "type")] + pub type_: String, + pub data: serde_json::Value, +} \ No newline at end of file diff --git a/crates/hyperswitch_domain_models/src/lib.rs b/crates/hyperswitch_domain_models/src/lib.rs index 02795481ad9c..203de8282f51 100644 --- a/crates/hyperswitch_domain_models/src/lib.rs +++ b/crates/hyperswitch_domain_models/src/lib.rs @@ -23,6 +23,7 @@ pub mod router_request_types; pub mod router_response_types; pub mod type_encryption; pub mod types; +pub mod callback_mapper; #[cfg(not(feature = "payouts"))] pub trait PayoutAttemptInterface {} diff --git a/crates/router/src/db/callback_mapper.rs b/crates/router/src/db/callback_mapper.rs index 9d235a976fa6..23febe99487e 100644 --- a/crates/router/src/db/callback_mapper.rs +++ b/crates/router/src/db/callback_mapper.rs @@ -1,5 +1,6 @@ use error_stack::report; use router_env::{instrument, tracing}; +use storage_impl::DataModelExt; use super::Store; use crate::{ @@ -7,18 +8,19 @@ use crate::{ core::errors::{self, CustomResult}, types::storage, }; +use hyperswitch_domain_models::callback_mapper::{self as DomainCallBackMapper}; #[async_trait::async_trait] pub trait CallBackMapperInterface { async fn insert_call_back_mapper( &self, - call_back_mapper: storage::CallBackMapperNew, - ) -> CustomResult; + call_back_mapper: DomainCallBackMapper::CallBackMapperNew, + ) -> CustomResult; async fn find_call_back_mapper_by_id( &self, id: String, - ) -> CustomResult; + ) -> CustomResult; } #[async_trait::async_trait] @@ -26,22 +28,27 @@ impl CallBackMapperInterface for Store { #[instrument(skip_all)] async fn insert_call_back_mapper( &self, - call_back_mapper: storage::CallBackMapperNew, - ) -> CustomResult { + call_back_mapper: DomainCallBackMapper::CallBackMapperNew, //take domain model as input + ) -> CustomResult { let conn = connection::pg_connection_write(self).await?; - call_back_mapper + let storage_model = call_back_mapper + .to_storage_model() .insert(&conn) .await - .map_err(|error| report!(errors::StorageError::from(error))) + .map_err(|error| report!(errors::StorageError::from(error)))?; + + // Convert the storage model back to domain model + Ok(DomainCallBackMapper::CallBackMapper::from_storage_model(storage_model)) } async fn find_call_back_mapper_by_id( &self, id: String, - ) -> CustomResult { + ) -> CustomResult { let conn = connection::pg_connection_read(self).await?; - storage::CallBackMapper::find_by_id(&conn, id) + Ok(DomainCallBackMapper::CallBackMapper::from_storage_model(storage::CallBackMapper::find_by_id(&conn, id) .await - .map_err(|error| report!(errors::StorageError::from(error))) + .map_err(|error| report!(errors::StorageError::from(error)))?)) + } } diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs index d7d283819e5f..358918063675 100644 --- a/crates/router/src/db/kafka_store.rs +++ b/crates/router/src/db/kafka_store.rs @@ -53,6 +53,7 @@ use crate::{ authentication::AuthenticationInterface, authorization::AuthorizationInterface, business_profile::ProfileInterface, + callback_mapper::CallBackMapperInterface, capture::CaptureInterface, cards_info::CardsInfoInterface, configs::ConfigInterface, @@ -3714,3 +3715,26 @@ impl ThemeInterface for KafkaStore { .await } } + +#[async_trait::async_trait] +impl CallBackMapperInterface for KafkaStore { + async fn insert_call_back_mapper( + &self, + call_back_mapper: domain::CallBackMapperNew, + ) -> CustomResult { + self.diesel_store + .insert_call_back_mapper(call_back_mapper) + .await + } + + async fn find_call_back_mapper_by_id( + &self, + id: String, + ) -> CustomResult { + self.diesel_store + .find_call_back_mapper_by_id(id) + .await + } + +} + diff --git a/crates/router/src/types/domain.rs b/crates/router/src/types/domain.rs index 070e583caabe..66bb30157292 100644 --- a/crates/router/src/types/domain.rs +++ b/crates/router/src/types/domain.rs @@ -16,6 +16,10 @@ mod customers { pub use hyperswitch_domain_models::customer::*; } +mod callback_mapper{ + pub use hyperswitch_domain_models::callback_mapper::{CallBackMapper, CallBackMapperNew}; +} + pub use customers::*; pub use merchant_account::*; @@ -39,6 +43,7 @@ pub mod user_key_store; pub use address::*; pub use business_profile::*; +pub use callback_mapper::*; pub use consts::*; pub use event::*; pub use merchant_connector_account::*; diff --git a/crates/storage_impl/src/callback_mapper.rs b/crates/storage_impl/src/callback_mapper.rs new file mode 100644 index 000000000000..16e6eb6a1333 --- /dev/null +++ b/crates/storage_impl/src/callback_mapper.rs @@ -0,0 +1,51 @@ +use diesel_models::callback_mapper::{ + CallBackMapper as DieselCallBackMapper, CallBackMapperNew as DieselCallBackMapperNew, +}; + +use hyperswitch_domain_models::callback_mapper::{CallBackMapper, CallBackMapperNew}; + +use crate::DataModelExt; + +impl DataModelExt for CallBackMapper { + type StorageModel = DieselCallBackMapper; + + fn to_storage_model(self) -> Self::StorageModel { + DieselCallBackMapper { + id: self.id, + type_: self.type_, + data: self.data, + created_at: self.created_at, + last_modified_at: self.last_modified_at, + } + } + + fn from_storage_model(storage_model: Self::StorageModel) -> Self { + Self { + id: storage_model.id, + type_: storage_model.type_, + data: storage_model.data, + created_at: storage_model.created_at, + last_modified_at: storage_model.last_modified_at, + } + } +} + +impl DataModelExt for CallBackMapperNew { + type StorageModel = DieselCallBackMapperNew; + + fn to_storage_model(self) -> Self::StorageModel { + DieselCallBackMapperNew { + id: self.id, + type_: self.type_, + data: self.data, + } + } + + fn from_storage_model(storage_model: Self::StorageModel) -> Self { + Self { + id: storage_model.id, + type_: storage_model.type_, + data: storage_model.data, + } + } +} diff --git a/crates/storage_impl/src/lib.rs b/crates/storage_impl/src/lib.rs index 5954f4791a57..c9a6e16832a9 100644 --- a/crates/storage_impl/src/lib.rs +++ b/crates/storage_impl/src/lib.rs @@ -6,6 +6,7 @@ use hyperswitch_domain_models::errors::{StorageError, StorageResult}; use masking::StrongSecret; use redis::{kv_store::RedisConnInterface, pub_sub::PubSubInterface, RedisStore}; mod address; +pub mod callback_mapper; pub mod config; pub mod connection; pub mod customers; From 38ba1376260f154cf3101e442af7f1109d7c678b Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2024 05:18:53 +0000 Subject: [PATCH 09/17] chore: run formatter --- crates/diesel_models/src/lib.rs | 10 +++++----- .../src/callback_mapper.rs | 2 +- crates/hyperswitch_domain_models/src/lib.rs | 2 +- crates/router/src/db/callback_mapper.rs | 15 +++++++++------ crates/router/src/db/kafka_store.rs | 6 +----- crates/router/src/types/domain.rs | 2 +- crates/storage_impl/src/callback_mapper.rs | 1 - 7 files changed, 18 insertions(+), 20 deletions(-) diff --git a/crates/diesel_models/src/lib.rs b/crates/diesel_models/src/lib.rs index 087fb2a4f067..4be16586a1e5 100644 --- a/crates/diesel_models/src/lib.rs +++ b/crates/diesel_models/src/lib.rs @@ -60,11 +60,11 @@ use diesel_impl::{DieselArray, OptionalDieselArray}; pub type StorageResult = error_stack::Result; pub type PgPooledConn = async_bb8_diesel::Connection; pub use self::{ - address::*, api_keys::*, cards_info::*, configs::*, customers::*, dispute::*, ephemeral_key::*, - events::*, file::*, generic_link::*, locker_mock_up::*, mandate::*, merchant_account::*, - merchant_connector_account::*, payment_attempt::*, payment_intent::*, payment_method::*, - payout_attempt::*, payouts::*, process_tracker::*, refund::*, reverse_lookup::*, - user_authentication_method::*, callback_mapper::*, + address::*, api_keys::*, callback_mapper::*, cards_info::*, configs::*, customers::*, + dispute::*, ephemeral_key::*, events::*, file::*, generic_link::*, locker_mock_up::*, + mandate::*, merchant_account::*, merchant_connector_account::*, payment_attempt::*, + payment_intent::*, payment_method::*, payout_attempt::*, payouts::*, process_tracker::*, + refund::*, reverse_lookup::*, user_authentication_method::*, }; /// The types and implementations provided by this module are required for the schema generated by diff --git a/crates/hyperswitch_domain_models/src/callback_mapper.rs b/crates/hyperswitch_domain_models/src/callback_mapper.rs index 89e8b60454ba..b0ad18b236e5 100644 --- a/crates/hyperswitch_domain_models/src/callback_mapper.rs +++ b/crates/hyperswitch_domain_models/src/callback_mapper.rs @@ -16,4 +16,4 @@ pub struct CallBackMapperNew { #[serde(rename = "type")] pub type_: String, pub data: serde_json::Value, -} \ No newline at end of file +} diff --git a/crates/hyperswitch_domain_models/src/lib.rs b/crates/hyperswitch_domain_models/src/lib.rs index 203de8282f51..33055c22f3a5 100644 --- a/crates/hyperswitch_domain_models/src/lib.rs +++ b/crates/hyperswitch_domain_models/src/lib.rs @@ -1,6 +1,7 @@ pub mod api; pub mod behaviour; pub mod business_profile; +pub mod callback_mapper; pub mod consts; pub mod customer; pub mod disputes; @@ -23,7 +24,6 @@ pub mod router_request_types; pub mod router_response_types; pub mod type_encryption; pub mod types; -pub mod callback_mapper; #[cfg(not(feature = "payouts"))] pub trait PayoutAttemptInterface {} diff --git a/crates/router/src/db/callback_mapper.rs b/crates/router/src/db/callback_mapper.rs index 23febe99487e..77c203816c35 100644 --- a/crates/router/src/db/callback_mapper.rs +++ b/crates/router/src/db/callback_mapper.rs @@ -1,4 +1,5 @@ use error_stack::report; +use hyperswitch_domain_models::callback_mapper::{self as DomainCallBackMapper}; use router_env::{instrument, tracing}; use storage_impl::DataModelExt; @@ -8,7 +9,6 @@ use crate::{ core::errors::{self, CustomResult}, types::storage, }; -use hyperswitch_domain_models::callback_mapper::{self as DomainCallBackMapper}; #[async_trait::async_trait] pub trait CallBackMapperInterface { @@ -38,7 +38,9 @@ impl CallBackMapperInterface for Store { .map_err(|error| report!(errors::StorageError::from(error)))?; // Convert the storage model back to domain model - Ok(DomainCallBackMapper::CallBackMapper::from_storage_model(storage_model)) + Ok(DomainCallBackMapper::CallBackMapper::from_storage_model( + storage_model, + )) } async fn find_call_back_mapper_by_id( @@ -46,9 +48,10 @@ impl CallBackMapperInterface for Store { id: String, ) -> CustomResult { let conn = connection::pg_connection_read(self).await?; - Ok(DomainCallBackMapper::CallBackMapper::from_storage_model(storage::CallBackMapper::find_by_id(&conn, id) - .await - .map_err(|error| report!(errors::StorageError::from(error)))?)) - + Ok(DomainCallBackMapper::CallBackMapper::from_storage_model( + storage::CallBackMapper::find_by_id(&conn, id) + .await + .map_err(|error| report!(errors::StorageError::from(error)))?, + )) } } diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs index 358918063675..db77c735f345 100644 --- a/crates/router/src/db/kafka_store.rs +++ b/crates/router/src/db/kafka_store.rs @@ -3731,10 +3731,6 @@ impl CallBackMapperInterface for KafkaStore { &self, id: String, ) -> CustomResult { - self.diesel_store - .find_call_back_mapper_by_id(id) - .await + self.diesel_store.find_call_back_mapper_by_id(id).await } - } - diff --git a/crates/router/src/types/domain.rs b/crates/router/src/types/domain.rs index 66bb30157292..f098805cb675 100644 --- a/crates/router/src/types/domain.rs +++ b/crates/router/src/types/domain.rs @@ -16,7 +16,7 @@ mod customers { pub use hyperswitch_domain_models::customer::*; } -mod callback_mapper{ +mod callback_mapper { pub use hyperswitch_domain_models::callback_mapper::{CallBackMapper, CallBackMapperNew}; } diff --git a/crates/storage_impl/src/callback_mapper.rs b/crates/storage_impl/src/callback_mapper.rs index 16e6eb6a1333..8bb9596ad5b0 100644 --- a/crates/storage_impl/src/callback_mapper.rs +++ b/crates/storage_impl/src/callback_mapper.rs @@ -1,7 +1,6 @@ use diesel_models::callback_mapper::{ CallBackMapper as DieselCallBackMapper, CallBackMapperNew as DieselCallBackMapperNew, }; - use hyperswitch_domain_models::callback_mapper::{CallBackMapper, CallBackMapperNew}; use crate::DataModelExt; From d7883e646648d4509eb833aff18cf7874fd6a503 Mon Sep 17 00:00:00 2001 From: Prasunna Soppa Date: Wed, 20 Nov 2024 11:33:14 +0530 Subject: [PATCH 10/17] code refactoring --- crates/diesel_models/src/callback_mapper.rs | 6 +++--- crates/hyperswitch_domain_models/src/callback_mapper.rs | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/diesel_models/src/callback_mapper.rs b/crates/diesel_models/src/callback_mapper.rs index 83c28a0f4c9a..33a7a079a2bf 100644 --- a/crates/diesel_models/src/callback_mapper.rs +++ b/crates/diesel_models/src/callback_mapper.rs @@ -1,6 +1,6 @@ +use common_utils::pii; use diesel::{Identifiable, Insertable, Queryable, Selectable}; use serde::{self, Deserialize, Serialize}; -use serde_json; use crate::schema::callback_mapper; @@ -12,7 +12,7 @@ pub struct CallBackMapper { pub id: String, #[serde(rename = "type")] pub type_: String, - pub data: serde_json::Value, + pub data: pii::SecretSerdeValue, pub created_at: time::PrimitiveDateTime, pub last_modified_at: time::PrimitiveDateTime, } @@ -23,5 +23,5 @@ pub struct CallBackMapperNew { pub id: String, #[serde(rename = "type")] pub type_: String, - pub data: serde_json::Value, + pub data: pii::SecretSerdeValue, } diff --git a/crates/hyperswitch_domain_models/src/callback_mapper.rs b/crates/hyperswitch_domain_models/src/callback_mapper.rs index 89e8b60454ba..3d140f597403 100644 --- a/crates/hyperswitch_domain_models/src/callback_mapper.rs +++ b/crates/hyperswitch_domain_models/src/callback_mapper.rs @@ -1,11 +1,14 @@ +use common_utils::pii; + use serde::{self, Deserialize, Serialize}; + #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] pub struct CallBackMapper { pub id: String, #[serde(rename = "type")] pub type_: String, - pub data: serde_json::Value, + pub data: pii::SecretSerdeValue, pub created_at: time::PrimitiveDateTime, pub last_modified_at: time::PrimitiveDateTime, } @@ -15,5 +18,5 @@ pub struct CallBackMapperNew { pub id: String, #[serde(rename = "type")] pub type_: String, - pub data: serde_json::Value, + pub data: pii::SecretSerdeValue, } \ No newline at end of file From 92ea722e5afd7ea41f19e6ca82e76e916e78def5 Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2024 06:06:13 +0000 Subject: [PATCH 11/17] chore: run formatter --- crates/hyperswitch_domain_models/src/callback_mapper.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/crates/hyperswitch_domain_models/src/callback_mapper.rs b/crates/hyperswitch_domain_models/src/callback_mapper.rs index 090cf6cb23ad..1e452f02352b 100644 --- a/crates/hyperswitch_domain_models/src/callback_mapper.rs +++ b/crates/hyperswitch_domain_models/src/callback_mapper.rs @@ -1,8 +1,6 @@ use common_utils::pii; - use serde::{self, Deserialize, Serialize}; - #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] pub struct CallBackMapper { pub id: String, From 401a44bddd2d79b8d5bea92db19a4039a3bfe853 Mon Sep 17 00:00:00 2001 From: Prasunna Soppa Date: Wed, 20 Nov 2024 18:40:22 +0530 Subject: [PATCH 12/17] fix failing checks --- crates/router/src/db/callback_mapper.rs | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/crates/router/src/db/callback_mapper.rs b/crates/router/src/db/callback_mapper.rs index 77c203816c35..7e800e416572 100644 --- a/crates/router/src/db/callback_mapper.rs +++ b/crates/router/src/db/callback_mapper.rs @@ -28,19 +28,15 @@ impl CallBackMapperInterface for Store { #[instrument(skip_all)] async fn insert_call_back_mapper( &self, - call_back_mapper: DomainCallBackMapper::CallBackMapperNew, //take domain model as input + call_back_mapper: DomainCallBackMapper::CallBackMapperNew, ) -> CustomResult { let conn = connection::pg_connection_write(self).await?; - let storage_model = call_back_mapper + call_back_mapper .to_storage_model() .insert(&conn) .await - .map_err(|error| report!(errors::StorageError::from(error)))?; - - // Convert the storage model back to domain model - Ok(DomainCallBackMapper::CallBackMapper::from_storage_model( - storage_model, - )) + .map_err(|error| report!(errors::StorageError::from(error))) + .map(DomainCallBackMapper::CallBackMapper::from_storage_model) } async fn find_call_back_mapper_by_id( @@ -48,10 +44,9 @@ impl CallBackMapperInterface for Store { id: String, ) -> CustomResult { let conn = connection::pg_connection_read(self).await?; - Ok(DomainCallBackMapper::CallBackMapper::from_storage_model( - storage::CallBackMapper::find_by_id(&conn, id) - .await - .map_err(|error| report!(errors::StorageError::from(error)))?, - )) + storage::CallBackMapper::find_by_id(&conn, id) + .await + .map_err(|error| report!(errors::StorageError::from(error))) + .map(DomainCallBackMapper::CallBackMapper::from_storage_model) } } From 90ea3bd90f24593765a99f37369ec4b55e24212d Mon Sep 17 00:00:00 2001 From: Prasunna Soppa Date: Mon, 2 Dec 2024 00:45:50 +0530 Subject: [PATCH 13/17] resolve pr comments --- crates/diesel_models/src/callback_mapper.rs | 6 ++-- .../src/query/callback_mapper.rs | 10 +++---- .../src/callback_mapper.rs | 6 ++-- crates/router/src/db/callback_mapper.rs | 28 +++++++++---------- crates/router/src/db/kafka_store.rs | 12 ++++---- crates/router/src/types/domain.rs | 2 +- .../src/types/storage/callback_mapper.rs | 2 +- crates/storage_impl/src/callback_mapper.rs | 20 +++++++------ .../up.sql | 5 ++-- 9 files changed, 50 insertions(+), 41 deletions(-) diff --git a/crates/diesel_models/src/callback_mapper.rs b/crates/diesel_models/src/callback_mapper.rs index 33a7a079a2bf..ee10258df376 100644 --- a/crates/diesel_models/src/callback_mapper.rs +++ b/crates/diesel_models/src/callback_mapper.rs @@ -8,7 +8,7 @@ use crate::schema::callback_mapper; Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Serialize, Deserialize, )] #[diesel(table_name = callback_mapper, primary_key(id), check_for_backend(diesel::pg::Pg))] -pub struct CallBackMapper { +pub struct CallbackMapper { pub id: String, #[serde(rename = "type")] pub type_: String, @@ -19,9 +19,11 @@ pub struct CallBackMapper { #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize, Insertable)] #[diesel(table_name = callback_mapper)] -pub struct CallBackMapperNew { +pub struct CallbackMapperNew { pub id: String, #[serde(rename = "type")] pub type_: String, pub data: pii::SecretSerdeValue, + pub created_at: time::PrimitiveDateTime, + pub last_modified_at: time::PrimitiveDateTime, } diff --git a/crates/diesel_models/src/query/callback_mapper.rs b/crates/diesel_models/src/query/callback_mapper.rs index 1e475f303dbf..1b9b3f111025 100644 --- a/crates/diesel_models/src/query/callback_mapper.rs +++ b/crates/diesel_models/src/query/callback_mapper.rs @@ -2,19 +2,19 @@ use diesel::{associations::HasTable, ExpressionMethods}; use super::generics; use crate::{ - callback_mapper::{CallBackMapper, CallBackMapperNew}, + callback_mapper::{CallbackMapper, CallbackMapperNew}, schema::callback_mapper::dsl, PgPooledConn, StorageResult, }; -impl CallBackMapperNew { - pub async fn insert(self, conn: &PgPooledConn) -> StorageResult { +impl CallbackMapperNew { + pub async fn insert(self, conn: &PgPooledConn) -> StorageResult { generics::generic_insert(conn, self).await } } -impl CallBackMapper { - pub async fn find_by_id(conn: &PgPooledConn, id: String) -> StorageResult { +impl CallbackMapper { + pub async fn find_by_id(conn: &PgPooledConn, id: &str) -> StorageResult { generics::generic_find_one::<::Table, _, _>( conn, dsl::id.eq(id.to_owned()), diff --git a/crates/hyperswitch_domain_models/src/callback_mapper.rs b/crates/hyperswitch_domain_models/src/callback_mapper.rs index 1e452f02352b..fcd051b4e87a 100644 --- a/crates/hyperswitch_domain_models/src/callback_mapper.rs +++ b/crates/hyperswitch_domain_models/src/callback_mapper.rs @@ -2,7 +2,7 @@ use common_utils::pii; use serde::{self, Deserialize, Serialize}; #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] -pub struct CallBackMapper { +pub struct CallbackMapper { pub id: String, #[serde(rename = "type")] pub type_: String, @@ -12,9 +12,11 @@ pub struct CallBackMapper { } #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] -pub struct CallBackMapperNew { +pub struct CallbackMapperNew { pub id: String, #[serde(rename = "type")] pub type_: String, pub data: pii::SecretSerdeValue, + pub created_at: time::PrimitiveDateTime, + pub last_modified_at: time::PrimitiveDateTime, } diff --git a/crates/router/src/db/callback_mapper.rs b/crates/router/src/db/callback_mapper.rs index 7e800e416572..86a8e62b8053 100644 --- a/crates/router/src/db/callback_mapper.rs +++ b/crates/router/src/db/callback_mapper.rs @@ -1,5 +1,5 @@ use error_stack::report; -use hyperswitch_domain_models::callback_mapper::{self as DomainCallBackMapper}; +use hyperswitch_domain_models::callback_mapper::{self as domain}; use router_env::{instrument, tracing}; use storage_impl::DataModelExt; @@ -11,42 +11,42 @@ use crate::{ }; #[async_trait::async_trait] -pub trait CallBackMapperInterface { +pub trait CallbackMapperInterface { async fn insert_call_back_mapper( &self, - call_back_mapper: DomainCallBackMapper::CallBackMapperNew, - ) -> CustomResult; + call_back_mapper: domain::CallbackMapperNew, + ) -> CustomResult; async fn find_call_back_mapper_by_id( &self, - id: String, - ) -> CustomResult; + id: &str, + ) -> CustomResult; } #[async_trait::async_trait] -impl CallBackMapperInterface for Store { +impl CallbackMapperInterface for Store { #[instrument(skip_all)] async fn insert_call_back_mapper( &self, - call_back_mapper: DomainCallBackMapper::CallBackMapperNew, - ) -> CustomResult { + call_back_mapper: domain::CallbackMapperNew, + ) -> CustomResult { let conn = connection::pg_connection_write(self).await?; call_back_mapper .to_storage_model() .insert(&conn) .await .map_err(|error| report!(errors::StorageError::from(error))) - .map(DomainCallBackMapper::CallBackMapper::from_storage_model) + .map(domain::CallbackMapper::from_storage_model) } async fn find_call_back_mapper_by_id( &self, - id: String, - ) -> CustomResult { + id: &str, + ) -> CustomResult { let conn = connection::pg_connection_read(self).await?; - storage::CallBackMapper::find_by_id(&conn, id) + storage::CallbackMapper::find_by_id(&conn, id) .await .map_err(|error| report!(errors::StorageError::from(error))) - .map(DomainCallBackMapper::CallBackMapper::from_storage_model) + .map(domain::CallbackMapper::from_storage_model) } } diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs index db77c735f345..2f00c4ba7f4f 100644 --- a/crates/router/src/db/kafka_store.rs +++ b/crates/router/src/db/kafka_store.rs @@ -53,7 +53,7 @@ use crate::{ authentication::AuthenticationInterface, authorization::AuthorizationInterface, business_profile::ProfileInterface, - callback_mapper::CallBackMapperInterface, + callback_mapper::CallbackMapperInterface, capture::CaptureInterface, cards_info::CardsInfoInterface, configs::ConfigInterface, @@ -3717,11 +3717,11 @@ impl ThemeInterface for KafkaStore { } #[async_trait::async_trait] -impl CallBackMapperInterface for KafkaStore { +impl CallbackMapperInterface for KafkaStore { async fn insert_call_back_mapper( &self, - call_back_mapper: domain::CallBackMapperNew, - ) -> CustomResult { + call_back_mapper: domain::CallbackMapperNew, + ) -> CustomResult { self.diesel_store .insert_call_back_mapper(call_back_mapper) .await @@ -3729,8 +3729,8 @@ impl CallBackMapperInterface for KafkaStore { async fn find_call_back_mapper_by_id( &self, - id: String, - ) -> CustomResult { + id: &str, + ) -> CustomResult { self.diesel_store.find_call_back_mapper_by_id(id).await } } diff --git a/crates/router/src/types/domain.rs b/crates/router/src/types/domain.rs index f098805cb675..4dfd4e6de75b 100644 --- a/crates/router/src/types/domain.rs +++ b/crates/router/src/types/domain.rs @@ -17,7 +17,7 @@ mod customers { } mod callback_mapper { - pub use hyperswitch_domain_models::callback_mapper::{CallBackMapper, CallBackMapperNew}; + pub use hyperswitch_domain_models::callback_mapper::{CallbackMapper, CallbackMapperNew}; } pub use customers::*; diff --git a/crates/router/src/types/storage/callback_mapper.rs b/crates/router/src/types/storage/callback_mapper.rs index cc8cc944838f..c323e074ef9a 100644 --- a/crates/router/src/types/storage/callback_mapper.rs +++ b/crates/router/src/types/storage/callback_mapper.rs @@ -1 +1 @@ -pub use diesel_models::callback_mapper::{CallBackMapper, CallBackMapperNew}; +pub use diesel_models::callback_mapper::{CallbackMapper, CallbackMapperNew}; diff --git a/crates/storage_impl/src/callback_mapper.rs b/crates/storage_impl/src/callback_mapper.rs index 8bb9596ad5b0..9229925d904d 100644 --- a/crates/storage_impl/src/callback_mapper.rs +++ b/crates/storage_impl/src/callback_mapper.rs @@ -1,15 +1,15 @@ use diesel_models::callback_mapper::{ - CallBackMapper as DieselCallBackMapper, CallBackMapperNew as DieselCallBackMapperNew, + CallbackMapper as DieselCallbackMapper, CallbackMapperNew as DieselCallbackMapperNew, }; -use hyperswitch_domain_models::callback_mapper::{CallBackMapper, CallBackMapperNew}; +use hyperswitch_domain_models::callback_mapper::{CallbackMapper, CallbackMapperNew}; use crate::DataModelExt; -impl DataModelExt for CallBackMapper { - type StorageModel = DieselCallBackMapper; +impl DataModelExt for CallbackMapper { + type StorageModel = DieselCallbackMapper; fn to_storage_model(self) -> Self::StorageModel { - DieselCallBackMapper { + DieselCallbackMapper { id: self.id, type_: self.type_, data: self.data, @@ -29,14 +29,16 @@ impl DataModelExt for CallBackMapper { } } -impl DataModelExt for CallBackMapperNew { - type StorageModel = DieselCallBackMapperNew; +impl DataModelExt for CallbackMapperNew { + type StorageModel = DieselCallbackMapperNew; fn to_storage_model(self) -> Self::StorageModel { - DieselCallBackMapperNew { + DieselCallbackMapperNew { id: self.id, type_: self.type_, data: self.data, + created_at: self.created_at, + last_modified_at: self.last_modified_at, } } @@ -45,6 +47,8 @@ impl DataModelExt for CallBackMapperNew { id: storage_model.id, type_: storage_model.type_, data: storage_model.data, + created_at: storage_model.created_at, + last_modified_at: storage_model.last_modified_at, } } } diff --git a/migrations/2024-11-13-105952_add_call-back-mapper_table/up.sql b/migrations/2024-11-13-105952_add_call-back-mapper_table/up.sql index f9df2c9537d3..1a9a635fcfd2 100644 --- a/migrations/2024-11-13-105952_add_call-back-mapper_table/up.sql +++ b/migrations/2024-11-13-105952_add_call-back-mapper_table/up.sql @@ -1,8 +1,9 @@ -- Your SQL goes here CREATE TABLE IF NOT EXISTS callback_mapper ( - id VARCHAR(128) NOT NULL PRIMARY KEY, + id VARCHAR(128) NOT NULL, type VARCHAR(64) NOT NULL, data JSONB NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT now()::TIMESTAMP, - last_modified_at TIMESTAMP NOT NULL DEFAULT now()::TIMESTAMP + last_modified_at TIMESTAMP NOT NULL DEFAULT now()::TIMESTAMP, + PRIMARY KEY (id, type) ); \ No newline at end of file From 60d19e0098b3988b78b70b191e0bdeabf7823cd4 Mon Sep 17 00:00:00 2001 From: Prasunna Soppa Date: Mon, 2 Dec 2024 12:16:28 +0530 Subject: [PATCH 14/17] fix migration schema --- crates/diesel_models/src/schema.rs | 2 +- crates/diesel_models/src/schema_v2.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs index 110a4b1ac2fa..3f997763ffc9 100644 --- a/crates/diesel_models/src/schema.rs +++ b/crates/diesel_models/src/schema.rs @@ -220,7 +220,7 @@ diesel::table! { use diesel::sql_types::*; use crate::enums::diesel_exports::*; - callback_mapper (id) { + callback_mapper (id, type_) { #[max_length = 128] id -> Varchar, #[sql_name = "type"] diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs index 91b268ab0b87..476222fac42e 100644 --- a/crates/diesel_models/src/schema_v2.rs +++ b/crates/diesel_models/src/schema_v2.rs @@ -228,7 +228,7 @@ diesel::table! { use diesel::sql_types::*; use crate::enums::diesel_exports::*; - callback_mapper (id) { + callback_mapper (id, type_) { #[max_length = 128] id -> Varchar, #[sql_name = "type"] From 890373ee104c9551dd874c73fb64e84d7d0dba9a Mon Sep 17 00:00:00 2001 From: Prasunna Soppa Date: Wed, 4 Dec 2024 17:16:39 +0530 Subject: [PATCH 15/17] resolve pr comments --- crates/diesel_models/src/callback_mapper.rs | 15 ++------- .../src/query/callback_mapper.rs | 6 ++-- .../src/callback_mapper.rs | 10 ------ crates/router/src/db/callback_mapper.rs | 6 ++-- crates/router/src/db/kafka_store.rs | 2 +- crates/router/src/types/domain.rs | 2 +- .../src/types/storage/callback_mapper.rs | 2 +- crates/storage_impl/src/callback_mapper.rs | 31 ++----------------- .../up.sql | 4 +-- 9 files changed, 15 insertions(+), 63 deletions(-) diff --git a/crates/diesel_models/src/callback_mapper.rs b/crates/diesel_models/src/callback_mapper.rs index ee10258df376..70ecdac189f6 100644 --- a/crates/diesel_models/src/callback_mapper.rs +++ b/crates/diesel_models/src/callback_mapper.rs @@ -5,9 +5,9 @@ use serde::{self, Deserialize, Serialize}; use crate::schema::callback_mapper; #[derive( - Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Serialize, Deserialize, + Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Serialize, Deserialize, Insertable )] -#[diesel(table_name = callback_mapper, primary_key(id), check_for_backend(diesel::pg::Pg))] +#[diesel(table_name = callback_mapper, primary_key(id, type_), check_for_backend(diesel::pg::Pg))] pub struct CallbackMapper { pub id: String, #[serde(rename = "type")] @@ -16,14 +16,3 @@ pub struct CallbackMapper { pub created_at: time::PrimitiveDateTime, pub last_modified_at: time::PrimitiveDateTime, } - -#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize, Insertable)] -#[diesel(table_name = callback_mapper)] -pub struct CallbackMapperNew { - pub id: String, - #[serde(rename = "type")] - pub type_: String, - pub data: pii::SecretSerdeValue, - pub created_at: time::PrimitiveDateTime, - pub last_modified_at: time::PrimitiveDateTime, -} diff --git a/crates/diesel_models/src/query/callback_mapper.rs b/crates/diesel_models/src/query/callback_mapper.rs index 1b9b3f111025..96434ff16a0d 100644 --- a/crates/diesel_models/src/query/callback_mapper.rs +++ b/crates/diesel_models/src/query/callback_mapper.rs @@ -2,18 +2,16 @@ use diesel::{associations::HasTable, ExpressionMethods}; use super::generics; use crate::{ - callback_mapper::{CallbackMapper, CallbackMapperNew}, + callback_mapper::CallbackMapper, schema::callback_mapper::dsl, PgPooledConn, StorageResult, }; -impl CallbackMapperNew { +impl CallbackMapper { pub async fn insert(self, conn: &PgPooledConn) -> StorageResult { generics::generic_insert(conn, self).await } -} -impl CallbackMapper { pub async fn find_by_id(conn: &PgPooledConn, id: &str) -> StorageResult { generics::generic_find_one::<::Table, _, _>( conn, diff --git a/crates/hyperswitch_domain_models/src/callback_mapper.rs b/crates/hyperswitch_domain_models/src/callback_mapper.rs index fcd051b4e87a..fffc33e572a4 100644 --- a/crates/hyperswitch_domain_models/src/callback_mapper.rs +++ b/crates/hyperswitch_domain_models/src/callback_mapper.rs @@ -10,13 +10,3 @@ pub struct CallbackMapper { pub created_at: time::PrimitiveDateTime, pub last_modified_at: time::PrimitiveDateTime, } - -#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] -pub struct CallbackMapperNew { - pub id: String, - #[serde(rename = "type")] - pub type_: String, - pub data: pii::SecretSerdeValue, - pub created_at: time::PrimitiveDateTime, - pub last_modified_at: time::PrimitiveDateTime, -} diff --git a/crates/router/src/db/callback_mapper.rs b/crates/router/src/db/callback_mapper.rs index 86a8e62b8053..d2326c41bee6 100644 --- a/crates/router/src/db/callback_mapper.rs +++ b/crates/router/src/db/callback_mapper.rs @@ -1,5 +1,5 @@ use error_stack::report; -use hyperswitch_domain_models::callback_mapper::{self as domain}; +use hyperswitch_domain_models::callback_mapper as domain; use router_env::{instrument, tracing}; use storage_impl::DataModelExt; @@ -14,7 +14,7 @@ use crate::{ pub trait CallbackMapperInterface { async fn insert_call_back_mapper( &self, - call_back_mapper: domain::CallbackMapperNew, + call_back_mapper: domain::CallbackMapper, ) -> CustomResult; async fn find_call_back_mapper_by_id( @@ -28,7 +28,7 @@ impl CallbackMapperInterface for Store { #[instrument(skip_all)] async fn insert_call_back_mapper( &self, - call_back_mapper: domain::CallbackMapperNew, + call_back_mapper: domain::CallbackMapper, ) -> CustomResult { let conn = connection::pg_connection_write(self).await?; call_back_mapper diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs index f60e51d673d6..3c676208ddc6 100644 --- a/crates/router/src/db/kafka_store.rs +++ b/crates/router/src/db/kafka_store.rs @@ -3746,7 +3746,7 @@ impl ThemeInterface for KafkaStore { impl CallbackMapperInterface for KafkaStore { async fn insert_call_back_mapper( &self, - call_back_mapper: domain::CallbackMapperNew, + call_back_mapper: domain::CallbackMapper, ) -> CustomResult { self.diesel_store .insert_call_back_mapper(call_back_mapper) diff --git a/crates/router/src/types/domain.rs b/crates/router/src/types/domain.rs index 4dfd4e6de75b..9a87b6d28be2 100644 --- a/crates/router/src/types/domain.rs +++ b/crates/router/src/types/domain.rs @@ -17,7 +17,7 @@ mod customers { } mod callback_mapper { - pub use hyperswitch_domain_models::callback_mapper::{CallbackMapper, CallbackMapperNew}; + pub use hyperswitch_domain_models::callback_mapper::CallbackMapper; } pub use customers::*; diff --git a/crates/router/src/types/storage/callback_mapper.rs b/crates/router/src/types/storage/callback_mapper.rs index c323e074ef9a..4f66a56c6f3a 100644 --- a/crates/router/src/types/storage/callback_mapper.rs +++ b/crates/router/src/types/storage/callback_mapper.rs @@ -1 +1 @@ -pub use diesel_models::callback_mapper::{CallbackMapper, CallbackMapperNew}; +pub use diesel_models::callback_mapper::CallbackMapper; diff --git a/crates/storage_impl/src/callback_mapper.rs b/crates/storage_impl/src/callback_mapper.rs index 9229925d904d..8b602f5d9824 100644 --- a/crates/storage_impl/src/callback_mapper.rs +++ b/crates/storage_impl/src/callback_mapper.rs @@ -1,7 +1,6 @@ -use diesel_models::callback_mapper::{ - CallbackMapper as DieselCallbackMapper, CallbackMapperNew as DieselCallbackMapperNew, -}; -use hyperswitch_domain_models::callback_mapper::{CallbackMapper, CallbackMapperNew}; +use diesel_models::callback_mapper:: + CallbackMapper as DieselCallbackMapper; +use hyperswitch_domain_models::callback_mapper::CallbackMapper; use crate::DataModelExt; @@ -28,27 +27,3 @@ impl DataModelExt for CallbackMapper { } } } - -impl DataModelExt for CallbackMapperNew { - type StorageModel = DieselCallbackMapperNew; - - fn to_storage_model(self) -> Self::StorageModel { - DieselCallbackMapperNew { - id: self.id, - type_: self.type_, - data: self.data, - created_at: self.created_at, - last_modified_at: self.last_modified_at, - } - } - - fn from_storage_model(storage_model: Self::StorageModel) -> Self { - Self { - id: storage_model.id, - type_: storage_model.type_, - data: storage_model.data, - created_at: storage_model.created_at, - last_modified_at: storage_model.last_modified_at, - } - } -} diff --git a/migrations/2024-11-13-105952_add_call-back-mapper_table/up.sql b/migrations/2024-11-13-105952_add_call-back-mapper_table/up.sql index 1a9a635fcfd2..604034f49348 100644 --- a/migrations/2024-11-13-105952_add_call-back-mapper_table/up.sql +++ b/migrations/2024-11-13-105952_add_call-back-mapper_table/up.sql @@ -3,7 +3,7 @@ CREATE TABLE IF NOT EXISTS callback_mapper ( id VARCHAR(128) NOT NULL, type VARCHAR(64) NOT NULL, data JSONB NOT NULL, - created_at TIMESTAMP NOT NULL DEFAULT now()::TIMESTAMP, - last_modified_at TIMESTAMP NOT NULL DEFAULT now()::TIMESTAMP, + created_at TIMESTAMP NOT NULL, + last_modified_at TIMESTAMP NOT NULL, PRIMARY KEY (id, type) ); \ No newline at end of file From 610b416426df2d5d04a382307d788159fe40b77f Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 12:56:14 +0000 Subject: [PATCH 16/17] chore: run formatter --- crates/diesel_models/src/callback_mapper.rs | 11 ++++++++++- crates/diesel_models/src/query/callback_mapper.rs | 4 +--- crates/storage_impl/src/callback_mapper.rs | 3 +-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/crates/diesel_models/src/callback_mapper.rs b/crates/diesel_models/src/callback_mapper.rs index 70ecdac189f6..3d00b929b767 100644 --- a/crates/diesel_models/src/callback_mapper.rs +++ b/crates/diesel_models/src/callback_mapper.rs @@ -5,7 +5,16 @@ use serde::{self, Deserialize, Serialize}; use crate::schema::callback_mapper; #[derive( - Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Serialize, Deserialize, Insertable + Clone, + Debug, + Eq, + PartialEq, + Identifiable, + Queryable, + Selectable, + Serialize, + Deserialize, + Insertable, )] #[diesel(table_name = callback_mapper, primary_key(id, type_), check_for_backend(diesel::pg::Pg))] pub struct CallbackMapper { diff --git a/crates/diesel_models/src/query/callback_mapper.rs b/crates/diesel_models/src/query/callback_mapper.rs index 96434ff16a0d..4b49455900e2 100644 --- a/crates/diesel_models/src/query/callback_mapper.rs +++ b/crates/diesel_models/src/query/callback_mapper.rs @@ -2,9 +2,7 @@ use diesel::{associations::HasTable, ExpressionMethods}; use super::generics; use crate::{ - callback_mapper::CallbackMapper, - schema::callback_mapper::dsl, - PgPooledConn, StorageResult, + callback_mapper::CallbackMapper, schema::callback_mapper::dsl, PgPooledConn, StorageResult, }; impl CallbackMapper { diff --git a/crates/storage_impl/src/callback_mapper.rs b/crates/storage_impl/src/callback_mapper.rs index 8b602f5d9824..186f2b7f9270 100644 --- a/crates/storage_impl/src/callback_mapper.rs +++ b/crates/storage_impl/src/callback_mapper.rs @@ -1,5 +1,4 @@ -use diesel_models::callback_mapper:: - CallbackMapper as DieselCallbackMapper; +use diesel_models::callback_mapper::CallbackMapper as DieselCallbackMapper; use hyperswitch_domain_models::callback_mapper::CallbackMapper; use crate::DataModelExt; From 1fb183fb7b4ed5f4186c68af98daa8178004f5fb Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 09:27:47 +0000 Subject: [PATCH 17/17] chore: run formatter --- crates/router/src/types/storage.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/router/src/types/storage.rs b/crates/router/src/types/storage.rs index 19e6bd85e524..96a0d5800561 100644 --- a/crates/router/src/types/storage.rs +++ b/crates/router/src/types/storage.rs @@ -66,11 +66,11 @@ pub use self::{ address::*, api_keys::*, authentication::*, authorization::*, blocklist::*, blocklist_fingerprint::*, blocklist_lookup::*, business_profile::*, callback_mapper::*, capture::*, cards_info::*, configs::*, customers::*, dashboard_metadata::*, dispute::*, - dynamic_routing_stats::*, ephemeral_key::*, events::*, file::*, fraud_check::*, generic_link::*, gsm::*, - locker_mock_up::*, mandate::*, merchant_account::*, merchant_connector_account::*, - merchant_key_store::*, payment_link::*, payment_method::*, process_tracker::*, refund::*, - reverse_lookup::*, role::*, routing_algorithm::*, unified_translations::*, user::*, - user_authentication_method::*, user_role::*, + dynamic_routing_stats::*, ephemeral_key::*, events::*, file::*, fraud_check::*, + generic_link::*, gsm::*, locker_mock_up::*, mandate::*, merchant_account::*, + merchant_connector_account::*, merchant_key_store::*, payment_link::*, payment_method::*, + process_tracker::*, refund::*, reverse_lookup::*, role::*, routing_algorithm::*, + unified_translations::*, user::*, user_authentication_method::*, user_role::*, }; use crate::types::api::routing;