Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
Bryan Frimin
2026-05-20 18:18:39 -07:00
parent 4d1a98ffdb
commit 8bf7be0c0d
22 changed files with 389 additions and 1026 deletions

View File

@@ -29,9 +29,7 @@ func (r *mutationResolver) CreateWebhookSubscription(ctx context.Context, input
return nil, err
}
prb := r.probo
wc, err := prb.WebhookSubscriptions.Create(
wc, err := r.probo.WebhookSubscriptions.Create(
ctx, scope,
probo.CreateWebhookSubscriptionRequest{
OrganizationID: input.OrganizationID,
@@ -61,9 +59,7 @@ func (r *mutationResolver) UpdateWebhookSubscription(ctx context.Context, input
return nil, err
}
prb := r.probo
wc, err := prb.WebhookSubscriptions.Update(
wc, err := r.probo.WebhookSubscriptions.Update(
ctx, scope,
probo.UpdateWebhookSubscriptionRequest{
WebhookSubscriptionID: input.ID,
@@ -93,9 +89,7 @@ func (r *mutationResolver) DeleteWebhookSubscription(ctx context.Context, input
return nil, err
}
prb := r.probo
if err := prb.WebhookSubscriptions.Delete(ctx, scope, input.WebhookSubscriptionID); err != nil {
if err := r.probo.WebhookSubscriptions.Delete(ctx, scope, input.WebhookSubscriptionID); err != nil {
r.logger.ErrorCtx(ctx, "cannot delete webhook subscription", log.Error(err))
return nil, gqlutils.Internal(ctx)
}
@@ -112,9 +106,7 @@ func (r *webhookEventConnectionResolver) TotalCount(ctx context.Context, obj *ty
return 0, err
}
prb := r.probo
count, err := prb.WebhookSubscriptions.CountEventsForSubscriptionID(ctx, scope, obj.ParentID)
count, err := r.probo.WebhookSubscriptions.CountEventsForSubscriptionID(ctx, scope, obj.ParentID)
if err != nil {
r.logger.ErrorCtx(ctx, "cannot count webhook events", log.Error(err))
return 0, gqlutils.Internal(ctx)
@@ -152,9 +144,7 @@ func (r *webhookSubscriptionResolver) SigningSecret(ctx context.Context, obj *ty
return "", err
}
prb := r.probo
signingSecret, err := prb.WebhookSubscriptions.GetSigningSecret(ctx, scope, obj.ID)
signingSecret, err := r.probo.WebhookSubscriptions.GetSigningSecret(ctx, scope, obj.ID)
if err != nil {
r.logger.ErrorCtx(ctx, "cannot get signing secret", log.Error(err))
return "", gqlutils.Internal(ctx)
@@ -170,8 +160,6 @@ func (r *webhookSubscriptionResolver) Events(ctx context.Context, obj *types.Web
return nil, err
}
prb := r.probo
pageOrderBy := page.OrderBy[coredata.WebhookEventOrderField]{
Field: coredata.WebhookEventOrderFieldCreatedAt,
Direction: page.OrderDirectionDesc,
@@ -185,7 +173,7 @@ func (r *webhookSubscriptionResolver) Events(ctx context.Context, obj *types.Web
cursor := types.NewCursor(first, after, last, before, pageOrderBy)
page, err := prb.WebhookSubscriptions.ListEventsForSubscriptionID(ctx, scope, obj.ID, cursor)
page, err := r.probo.WebhookSubscriptions.ListEventsForSubscriptionID(ctx, scope, obj.ID, cursor)
if err != nil {
r.logger.ErrorCtx(ctx, "cannot list webhook events", log.Error(err))
return nil, gqlutils.Internal(ctx)
@@ -206,11 +194,9 @@ func (r *webhookSubscriptionConnectionResolver) TotalCount(ctx context.Context,
return 0, err
}
prb := r.probo
switch obj.Resolver.(type) {
case *organizationResolver:
count, err := prb.WebhookSubscriptions.CountForOrganizationID(ctx, scope, obj.ParentID)
count, err := r.probo.WebhookSubscriptions.CountForOrganizationID(ctx, scope, obj.ParentID)
if err != nil {
r.logger.ErrorCtx(ctx, "cannot count webhook subscriptions", log.Error(err))
return 0, gqlutils.Internal(ctx)