Add webhook calls ui

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2026-02-12 17:09:40 +01:00
parent f9de9c4834
commit a345e0be02
11 changed files with 1925 additions and 5 deletions

View File

@@ -261,6 +261,58 @@ func (s WebhookConfigurationService) GetSigningSecret(
return wc.DecryptSigningSecret(s.svc.encryptionKey)
}
func (s WebhookConfigurationService) ListCallsForConfigurationID(
ctx context.Context,
webhookConfigurationID gid.GID,
cursor *page.Cursor[coredata.WebhookCallOrderField],
) (*page.Page[*coredata.WebhookCall, coredata.WebhookCallOrderField], error) {
var calls coredata.WebhookCalls
err := s.svc.pg.WithConn(
ctx,
func(conn pg.Conn) error {
if err := calls.LoadByConfigurationID(ctx, conn, s.svc.scope, webhookConfigurationID, cursor); err != nil {
return fmt.Errorf("cannot load webhook calls: %w", err)
}
return nil
},
)
if err != nil {
return nil, err
}
return page.NewPage(calls, cursor), nil
}
func (s WebhookConfigurationService) CountCallsForConfigurationID(
ctx context.Context,
webhookConfigurationID gid.GID,
) (int, error) {
var count int
err := s.svc.pg.WithConn(
ctx,
func(conn pg.Conn) (err error) {
calls := &coredata.WebhookCalls{}
count, err = calls.CountByConfigurationID(ctx, conn, s.svc.scope, webhookConfigurationID)
if err != nil {
return fmt.Errorf("cannot count webhook calls: %w", err)
}
return nil
},
)
if err != nil {
return 0, err
}
return count, nil
}
func (s WebhookConfigurationService) Delete(
ctx context.Context,
webhookConfigurationID gid.GID,