Skip to content

Commit d47da55

Browse files
committed
feat(events): flatten api event type details
1 parent 54a598a commit d47da55

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

crates/router/src/events/api_logs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub struct ApiEvent {
1212
request_id: String,
1313
latency: u128,
1414
status_code: i64,
15+
#[serde(flatten)]
1516
auth_type: AuthenticationType,
1617
request: serde_json::Value,
1718
response: Option<serde_json::Value>,

crates/router/src/services/authentication.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ pub struct AuthenticationData {
2929
}
3030

3131
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
32+
#[serde(tag = "api_auth_type")]
3233
pub enum AuthenticationType {
3334
ApiKey {
3435
merchant_id: String,
@@ -37,7 +38,7 @@ pub enum AuthenticationType {
3738
AdminApiKey,
3839
MerchantJWT {
3940
merchant_id: String,
40-
user_email: Option<String>,
41+
user_id: Option<String>,
4142
},
4243
MerchantID {
4344
merchant_id: String,
@@ -59,7 +60,7 @@ impl AuthenticationType {
5960
| Self::PublishableKey { merchant_id }
6061
| Self::MerchantJWT {
6162
merchant_id,
62-
user_email: _,
63+
user_id: _,
6364
} => Some(merchant_id.as_ref()),
6465
Self::AdminApiKey | Self::NoAuth => None,
6566
}
@@ -411,7 +412,7 @@ where
411412
auth.clone(),
412413
AuthenticationType::MerchantJWT {
413414
merchant_id: auth.merchant_account.merchant_id.clone(),
414-
user_email: None,
415+
user_id: None,
415416
},
416417
))
417418
}

0 commit comments

Comments
 (0)