~edwargix/git.sr.ht

7b9c23f7455df19adcfadf33b215191734b0c88a — Drew DeVault 3 years ago 9a4f4f0
API: Update core-go
4 files changed, 12 insertions(+), 9 deletions(-)

M api/go.mod
M api/go.sum
M api/graph/schema.graphqls
M api/webhooks/webhooks.go
M api/go.mod => api/go.mod +1 -1
@@ 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

M api/go.sum => api/go.sum +2 -0
@@ 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=

M api/graph/schema.graphqls => api/graph/schema.graphqls +4 -4
@@ 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)
}

M api/webhooks/webhooks.go => api/webhooks/webhooks.go +5 -4
@@ 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)
}