~edwargix/git.sr.ht

e02b460f841ea69930de6646d3d477b7489d4f42 — Thorben Günther 1 year, 7 months ago 2369d4a
api: Rename user webhook mutations

Conform with terminology of other services.
Make deleteUserWebhook non-nullable.
2 files changed, 7 insertions(+), 7 deletions(-)

M api/graph/schema.graphqls
M api/graph/schema.resolvers.go
M api/graph/schema.graphqls => api/graph/schema.graphqls +2 -2
@@ 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.

M api/graph/schema.resolvers.go => api/graph/schema.resolvers.go +5 -5
@@ 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
	}