mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 04:04:43 +08:00
refactor(merchant_id): create domain type for merchant_id (#5408)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Sanchith Hegde <22217505+SanchithHegde@users.noreply.github.com>
This commit is contained in:
@ -31,17 +31,17 @@ use crate::{
|
||||
pub async fn api_events_core(
|
||||
pool: &AnalyticsProvider,
|
||||
req: ApiLogsRequest,
|
||||
merchant_id: String,
|
||||
merchant_id: &common_utils::id_type::MerchantId,
|
||||
) -> AnalyticsResult<Vec<ApiLogsResult>> {
|
||||
let data = match pool {
|
||||
AnalyticsProvider::Sqlx(_) => Err(FiltersError::NotImplemented(
|
||||
"API Events not implemented for SQLX",
|
||||
))
|
||||
.attach_printable("SQL Analytics is not implemented for API Events"),
|
||||
AnalyticsProvider::Clickhouse(pool) => get_api_event(&merchant_id, req, pool).await,
|
||||
AnalyticsProvider::Clickhouse(pool) => get_api_event(merchant_id, req, pool).await,
|
||||
AnalyticsProvider::CombinedSqlx(_sqlx_pool, ckh_pool)
|
||||
| AnalyticsProvider::CombinedCkh(_sqlx_pool, ckh_pool) => {
|
||||
get_api_event(&merchant_id, req, ckh_pool).await
|
||||
get_api_event(merchant_id, req, ckh_pool).await
|
||||
}
|
||||
}
|
||||
.switch()?;
|
||||
@ -51,7 +51,7 @@ pub async fn api_events_core(
|
||||
pub async fn get_filters(
|
||||
pool: &AnalyticsProvider,
|
||||
req: GetApiEventFiltersRequest,
|
||||
merchant_id: String,
|
||||
merchant_id: &common_utils::id_type::MerchantId,
|
||||
) -> AnalyticsResult<ApiEventFiltersResponse> {
|
||||
use api_models::analytics::{api_event::ApiEventDimensions, ApiEventFilterValue};
|
||||
|
||||
@ -68,7 +68,7 @@ pub async fn get_filters(
|
||||
AnalyticsProvider::Clickhouse(ckh_pool)
|
||||
| AnalyticsProvider::CombinedSqlx(_, ckh_pool)
|
||||
| AnalyticsProvider::CombinedCkh(_, ckh_pool) => {
|
||||
get_api_event_filter_for_dimension(dim, &merchant_id, &req.time_range, ckh_pool)
|
||||
get_api_event_filter_for_dimension(dim, merchant_id, &req.time_range, ckh_pool)
|
||||
.await
|
||||
}
|
||||
}
|
||||
@ -92,7 +92,7 @@ pub async fn get_filters(
|
||||
#[instrument(skip_all)]
|
||||
pub async fn get_api_event_metrics(
|
||||
pool: &AnalyticsProvider,
|
||||
merchant_id: &str,
|
||||
merchant_id: &common_utils::id_type::MerchantId,
|
||||
req: GetApiEventMetricRequest,
|
||||
) -> AnalyticsResult<MetricsResponse<ApiMetricsBucketResponse>> {
|
||||
let mut metrics_accumulator: HashMap<ApiEventMetricsBucketIdentifier, ApiEventMetricRow> =
|
||||
|
||||
Reference in New Issue
Block a user