feat(webhooks): Adding event search option in the webhooks page (#9907)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Venu Madhav Bandarupalli
2025-10-24 13:32:04 +05:30
committed by GitHub
parent 8fd8884d5c
commit b0d5a1b046
7 changed files with 98 additions and 45 deletions

View File

@ -46,10 +46,11 @@ impl Event {
.await
}
pub async fn list_initial_attempts_by_merchant_id_primary_object_id(
pub async fn list_initial_attempts_by_merchant_id_primary_object_id_or_initial_attempt_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
primary_object_id: &str,
initial_attempt_id: &str,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<<Self as HasTable>::Table, _, _, _>(
conn,
@ -57,7 +58,11 @@ impl Event {
.nullable()
.eq(dsl::initial_attempt_id) // Filter initial attempts only
.and(dsl::merchant_id.eq(merchant_id.to_owned()))
.and(dsl::primary_object_id.eq(primary_object_id.to_owned())),
.and(
dsl::primary_object_id
.eq(primary_object_id.to_owned())
.or(dsl::initial_attempt_id.eq(initial_attempt_id.to_owned())),
),
None,
None,
Some(dsl::created_at.desc()),
@ -129,10 +134,11 @@ impl Event {
.await
}
pub async fn list_initial_attempts_by_profile_id_primary_object_id(
pub async fn list_initial_attempts_by_profile_id_primary_object_id_or_initial_attempt_id(
conn: &PgPooledConn,
profile_id: &common_utils::id_type::ProfileId,
primary_object_id: &str,
initial_attempt_id: &str,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<<Self as HasTable>::Table, _, _, _>(
conn,
@ -140,7 +146,11 @@ impl Event {
.nullable()
.eq(dsl::initial_attempt_id) // Filter initial attempts only
.and(dsl::business_profile_id.eq(profile_id.to_owned()))
.and(dsl::primary_object_id.eq(primary_object_id.to_owned())),
.and(
dsl::primary_object_id
.eq(primary_object_id.to_owned())
.or(dsl::initial_attempt_id.eq(initial_attempt_id.to_owned())),
),
None,
None,
Some(dsl::created_at.desc()),