From 7b9c23f7455df19adcfadf33b215191734b0c88a Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 9 Sep 2021 10:54:58 +0200 Subject: [PATCH] API: Update core-go --- api/go.mod | 2 +- api/go.sum | 2 ++ api/graph/schema.graphqls | 8 ++++---- api/webhooks/webhooks.go | 9 +++++---- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/api/go.mod b/api/go.mod index dcea618..c6e5b96 100644 --- a/api/go.mod +++ b/api/go.mod @@ -3,7 +3,7 @@ module git.sr.ht/~sircmpwn/git.sr.ht/api go 1.14 require ( - git.sr.ht/~sircmpwn/core-go v0.0.0-20210825094745-ae61e2431576 + git.sr.ht/~sircmpwn/core-go v0.0.0-20210909084213-468752564125 github.com/99designs/gqlgen v0.13.0 github.com/Masterminds/squirrel v1.4.0 github.com/agnivade/levenshtein v1.1.0 // indirect diff --git a/api/go.sum b/api/go.sum index 74e5710..f262553 100644 --- a/api/go.sum +++ b/api/go.sum @@ -40,6 +40,8 @@ git.sr.ht/~sircmpwn/core-go v0.0.0-20210721073626-39cd24bd091d h1:Brqt/hVm3ZSNOb git.sr.ht/~sircmpwn/core-go v0.0.0-20210721073626-39cd24bd091d/go.mod h1:xKaQeRLMV136HaItd00yy6W2HeKeJJR2jp9p0Fsu0qM= git.sr.ht/~sircmpwn/core-go v0.0.0-20210825094745-ae61e2431576 h1:X5Uw5wlw9Wcdn8arjbT+zyWbO2ImboRiIEUbNXkm+Vw= git.sr.ht/~sircmpwn/core-go v0.0.0-20210825094745-ae61e2431576/go.mod h1:dOzMmMQFPH0ztBhLFNo/hFLHqck1tbhgL3aNi1XnOsI= +git.sr.ht/~sircmpwn/core-go v0.0.0-20210909084213-468752564125 h1:UbY+U6d65kx09HhIDkakHd55uGb9SSVta76uyHjqKW8= +git.sr.ht/~sircmpwn/core-go v0.0.0-20210909084213-468752564125/go.mod h1:dOzMmMQFPH0ztBhLFNo/hFLHqck1tbhgL3aNi1XnOsI= git.sr.ht/~sircmpwn/dowork v0.0.0-20201013160733-35ca012e4dc8/go.mod h1:8neHEO3503w/rNtttnR0JFpQgM/GFhaafVwvkPsFIDw= git.sr.ht/~sircmpwn/dowork v0.0.0-20201121170652-c2a771442daf h1:wRE9o+wlpTSuq/ucFJsfbglAobfGPIgFdaTtZXrk8P0= git.sr.ht/~sircmpwn/dowork v0.0.0-20201121170652-c2a771442daf/go.mod h1:8neHEO3503w/rNtttnR0JFpQgM/GFhaafVwvkPsFIDw= diff --git a/api/graph/schema.graphqls b/api/graph/schema.graphqls index 93945b8..b3ec4d6 100644 --- a/api/graph/schema.graphqls +++ b/api/graph/schema.graphqls @@ -363,21 +363,21 @@ type Mutation { createRepository(name: String!, visibility: Visibility!, description: String): Repository! @access(scope: REPOSITORIES, kind: RW) # Updates the metadata for a git repository - updateRepository(id: Int!, input: RepoInput!): Repository! @access(scope: REPOSITORIES, kind: RW) + updateRepository(id: Int!, input: RepoInput!): Repository @access(scope: REPOSITORIES, kind: RW) # Deletes a git repository - deleteRepository(id: Int!): Repository! @access(scope: REPOSITORIES, kind: RW) + deleteRepository(id: Int!): Repository @access(scope: REPOSITORIES, kind: RW) # Adds or updates a user in the access control list updateACL(repoId: Int!, mode: AccessMode!, entity: ID!): ACL! @access(scope: ACLS, kind: RW) # Deletes an entry from the access control list - deleteACL(id: Int!): ACL! @access(scope: ACLS, kind: RW) + deleteACL(id: Int!): ACL @access(scope: ACLS, kind: RW) # Uploads an artifact. revspec must match a specific git tag, and the # filename must be unique among artifacts for this repository. uploadArtifact(repoId: Int!, revspec: String!, file: Upload!): Artifact! @access(scope: OBJECTS, kind: RW) # Deletes an artifact. - deleteArtifact(id: Int!): Artifact! @access(scope: OBJECTS, kind: RW) + deleteArtifact(id: Int!): Artifact @access(scope: OBJECTS, kind: RW) } diff --git a/api/webhooks/webhooks.go b/api/webhooks/webhooks.go index 835835e..b5d049b 100644 --- a/api/webhooks/webhooks.go +++ b/api/webhooks/webhooks.go @@ -25,7 +25,8 @@ type contextKey struct { } func LegacyMiddleware( - queue *webhooks.LegacyQueue) func(next http.Handler) http.Handler { + queue *webhooks.LegacyQueue, +) func(next http.Handler) http.Handler { return func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ctx := context.WithValue(r.Context(), legacyUserCtxKey, queue) @@ -84,7 +85,7 @@ func DeliverLegacyRepoCreate(ctx context.Context, repo *model.Repository) { Select(). From("user_webhook_subscription sub"). Where("sub.user_id = ?", repo.OwnerID) - q.Schedule(query, "user", "repo:create", encoded) + q.Schedule(ctx, query, "user", "repo:create", encoded) } func DeliverLegacyRepoUpdate(ctx context.Context, repo *model.Repository) { @@ -122,7 +123,7 @@ func DeliverLegacyRepoUpdate(ctx context.Context, repo *model.Repository) { Select(). From("user_webhook_subscription sub"). Where("sub.user_id = ?", repo.OwnerID) - q.Schedule(query, "user", "repo:update", encoded) + q.Schedule(ctx, query, "user", "repo:update", encoded) } func DeliverLegacyRepoDeleted(ctx context.Context, repo *model.Repository) { @@ -144,5 +145,5 @@ func DeliverLegacyRepoDeleted(ctx context.Context, repo *model.Repository) { Select(). From("user_webhook_subscription sub"). Where("sub.user_id = ?", repo.OwnerID) - q.Schedule(query, "user", "repo:delete", encoded) + q.Schedule(ctx, query, "user", "repo:delete", encoded) } -- 2.38.4