From e02b460f841ea69930de6646d3d477b7489d4f42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorben=20G=C3=BCnther?= Date: Fri, 4 Nov 2022 12:27:59 +0100 Subject: [PATCH] api: Rename user webhook mutations Conform with terminology of other services. Make deleteUserWebhook non-nullable. --- api/graph/schema.graphqls | 4 ++-- api/graph/schema.resolvers.go | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/graph/schema.graphqls b/api/graph/schema.graphqls index 37df6c9..4f6bd15 100644 --- a/api/graph/schema.graphqls +++ b/api/graph/schema.graphqls @@ -562,7 +562,7 @@ type Mutation { may be used to access details of the event which trigged the webhook. The query may not make any mutations. """ - createWebhook(config: UserWebhookInput!): WebhookSubscription! + createUserWebhook(config: UserWebhookInput!): WebhookSubscription! """ Deletes a user webhook. Any events already queued may still be @@ -572,7 +572,7 @@ type Mutation { Manually deleting a webhook configured by a third-party client may cause unexpected behavior with the third-party integration. """ - deleteWebhook(id: Int!): WebhookSubscription + deleteUserWebhook(id: Int!): WebhookSubscription! """ Deletes the authenticated user's account. Internal use only. diff --git a/api/graph/schema.resolvers.go b/api/graph/schema.resolvers.go index d281a28..2a6f54a 100644 --- a/api/graph/schema.resolvers.go +++ b/api/graph/schema.resolvers.go @@ -752,8 +752,8 @@ func (r *mutationResolver) DeleteArtifact(ctx context.Context, id int) (*model.A return &artifact, nil } -// CreateWebhook is the resolver for the createWebhook field. -func (r *mutationResolver) CreateWebhook(ctx context.Context, config model.UserWebhookInput) (model.WebhookSubscription, error) { +// CreateUserWebhook is the resolver for the createUserWebhook field. +func (r *mutationResolver) CreateUserWebhook(ctx context.Context, config model.UserWebhookInput) (model.WebhookSubscription, error) { schema := server.ForContext(ctx).Schema if err := corewebhooks.Validate(schema, config.Query); err != nil { return nil, err @@ -827,8 +827,8 @@ func (r *mutationResolver) CreateWebhook(ctx context.Context, config model.UserW return &sub, nil } -// DeleteWebhook is the resolver for the deleteWebhook field. -func (r *mutationResolver) DeleteWebhook(ctx context.Context, id int) (model.WebhookSubscription, error) { +// DeleteUserWebhook is the resolver for the deleteUserWebhook field. +func (r *mutationResolver) DeleteUserWebhook(ctx context.Context, id int) (model.WebhookSubscription, error) { var sub model.UserWebhookSubscription filter, err := corewebhooks.FilterWebhooks(ctx) @@ -850,7 +850,7 @@ func (r *mutationResolver) DeleteWebhook(ctx context.Context, id int) (model.Web return nil }); err != nil { if err == sql.ErrNoRows { - return nil, nil + return nil, fmt.Errorf("No user webhook by ID %d found for this user", id) } return nil, err } -- 2.38.4