feat(analytics): authentication analytics (#4429)

Co-authored-by: Sampras Lopes <lsampras@pm.me>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Vrishab Srivatsa
2024-05-10 15:38:26 +05:30
committed by GitHub
parent 86e05501cb
commit 24d154248c
28 changed files with 790 additions and 418 deletions

View File

@ -4,6 +4,7 @@ use api_models::{
analytics::{
self as analytics_api,
api_event::ApiEventDimensions,
auth_events::AuthEventFlows,
disputes::DisputeDimensions,
payments::{PaymentDimensions, PaymentDistributions},
refunds::{RefundDimensions, RefundType},
@ -247,6 +248,11 @@ pub enum Aggregate<R> {
field: R,
alias: Option<&'static str>,
},
Percentile {
field: R,
alias: Option<&'static str>,
percentile: Option<&'static u8>,
},
}
// Window functions in query
@ -379,11 +385,17 @@ impl_to_sql_for_to_string!(
Order
);
impl_to_sql_for_to_string!(&SdkEventDimensions, SdkEventDimensions, SdkEventNames);
impl_to_sql_for_to_string!(&ApiEventDimensions, ApiEventDimensions);
impl_to_sql_for_to_string!(&DisputeDimensions, DisputeDimensions, DisputeStage);
impl_to_sql_for_to_string!(
&SdkEventDimensions,
SdkEventDimensions,
SdkEventNames,
AuthEventFlows,
&ApiEventDimensions,
ApiEventDimensions,
&DisputeDimensions,
DisputeDimensions,
DisputeStage
);
#[derive(Debug)]
pub enum FilterTypes {
@ -507,6 +519,14 @@ where
self.add_custom_filter_clause(key, value, FilterTypes::EqualBool)
}
pub fn add_negative_filter_clause(
&mut self,
key: impl ToSql<T>,
value: impl ToSql<T>,
) -> QueryResult<()> {
self.add_custom_filter_clause(key, value, FilterTypes::NotEqual)
}
pub fn add_custom_filter_clause(
&mut self,
lhs: impl ToSql<T>,