Skip to content

Commit

Permalink
fix: remove /storage from the path (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarrosop authored May 24, 2022
1 parent de48ecd commit b4b4fb4
Show file tree
Hide file tree
Showing 20 changed files with 25 additions and 21 deletions.
3 changes: 2 additions & 1 deletion client/delete_file_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build integration
// +build integration

package client_test
Expand All @@ -14,7 +15,7 @@ import (
)

func TestDeleteFile(t *testing.T) {
baseURL := "http://localhost:8000/v1/storage"
baseURL := "http://localhost:8000/v1"
cl := client.New(baseURL, os.Getenv("HASURA_AUTH_BEARER"))

id1 := uuid.NewString()
Expand Down
2 changes: 1 addition & 1 deletion client/get_file_information_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

func TestGetFileInformation(t *testing.T) {
baseURL := "http://localhost:8000/v1/storage"
baseURL := "http://localhost:8000/v1"
cl := client.New(baseURL, os.Getenv("HASURA_AUTH_BEARER"))

files := []fileHelper{
Expand Down
3 changes: 2 additions & 1 deletion client/get_file_presignedurl_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build integration
// +build integration

package client_test
Expand All @@ -23,7 +24,7 @@ func EquateStrings(name string, expected string) cmp.Option {
}

func TestGetFilePresignedURL(t *testing.T) {
baseURL := "http://localhost:8000/v1/storage"
baseURL := "http://localhost:8000/v1"
cl := client.New(baseURL, os.Getenv("HASURA_AUTH_BEARER"))

files := []fileHelper{
Expand Down
2 changes: 1 addition & 1 deletion client/get_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
)

func TestGetFile(t *testing.T) {
baseURL := "http://localhost:8000/v1/storage"
baseURL := "http://localhost:8000/v1"
cl := client.New(baseURL, os.Getenv("HASURA_AUTH_BEARER"))

files := []fileHelper{
Expand Down
3 changes: 2 additions & 1 deletion client/update_file_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build integration
// +build integration

package client_test
Expand Down Expand Up @@ -31,7 +32,7 @@ func updateFile(
}

func TestUpdateFile(t *testing.T) {
baseURL := "http://localhost:8000/v1/storage"
baseURL := "http://localhost:8000/v1"
cl := client.New(baseURL, os.Getenv("HASURA_AUTH_BEARER"))

id1 := uuid.NewString()
Expand Down
3 changes: 2 additions & 1 deletion client/upload_file_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build integration
// +build integration

package client_test
Expand Down Expand Up @@ -41,7 +42,7 @@ func uploadFiles(
}

func TestUploadFile(t *testing.T) {
baseURL := "http://localhost:8000/v1/storage"
baseURL := "http://localhost:8000/v1"
cl := client.New(baseURL, os.Getenv("HASURA_AUTH_BEARER"))

id1 := uuid.NewString()
Expand Down
2 changes: 1 addition & 1 deletion controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (ctrl *Controller) SetupRouter(trustedProxies []string, middleware ...gin.H

router.GET("/healthz", ctrl.Health)

apiRoot := router.Group("/v1/storage")
apiRoot := router.Group("/v1")
{
apiRoot.GET("/openapi.yaml", ctrl.OpenAPI)
apiRoot.GET("/version", ctrl.Version)
Expand Down
2 changes: 1 addition & 1 deletion controller/delete_broken_metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func TestDeleteBrokenMetadata(t *testing.T) {

responseRecorder := httptest.NewRecorder()

req, _ := http.NewRequestWithContext(context.Background(), "POST", "/v1/storage/ops/delete-broken-metadata", nil)
req, _ := http.NewRequestWithContext(context.Background(), "POST", "/v1/ops/delete-broken-metadata", nil)

router.ServeHTTP(responseRecorder, req)

Expand Down
2 changes: 1 addition & 1 deletion controller/delete_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func TestDeleteFile(t *testing.T) {
req, _ := http.NewRequestWithContext(
context.Background(),
"DELETE",
"/v1/storage/files/55af1e60-0f28-454e-885e-ea6aab2bb288",
"/v1/files/55af1e60-0f28-454e-885e-ea6aab2bb288",
nil,
)

Expand Down
2 changes: 1 addition & 1 deletion controller/delete_orphans_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func TestDeleteOrphans(t *testing.T) {

responseRecorder := httptest.NewRecorder()

req, _ := http.NewRequestWithContext(context.Background(), "POST", "/v1/storage/ops/delete-orphans", nil)
req, _ := http.NewRequestWithContext(context.Background(), "POST", "/v1/ops/delete-orphans", nil)

router.ServeHTTP(responseRecorder, req)

Expand Down
2 changes: 1 addition & 1 deletion controller/get_file_information_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func TestGetFileInfo(t *testing.T) {
req, _ := http.NewRequestWithContext(
context.Background(),
"HEAD",
"/v1/storage/files/55af1e60-0f28-454e-885e-ea6aab2bb288",
"/v1/files/55af1e60-0f28-454e-885e-ea6aab2bb288",
nil,
)

Expand Down
2 changes: 1 addition & 1 deletion controller/get_file_presigned_url.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (ctrl *Controller) getFilePresignedURL(ctx *gin.Context) (GetFilePresignedU
apiErr.ExtendError(fmt.Sprintf("problem creating presigned URL for file %s", fileMetadata.Name))
}

url := fmt.Sprintf("%s/v1/storage/files/%s/presignedurl/content?%s", ctrl.publicURL, fileMetadata.ID, signature)
url := fmt.Sprintf("%s/v1/files/%s/presignedurl/content?%s", ctrl.publicURL, fileMetadata.ID, signature)
return GetFilePresignedURLResponse{nil, url, bucketMetadata.DownloadExpiration}, nil
}

Expand Down
4 changes: 2 additions & 2 deletions controller/get_file_presigned_url_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func TestGetFilePresignedURL(t *testing.T) {
req, err := http.NewRequestWithContext(
context.Background(),
"GET",
"/v1/storage/files/55af1e60-0f28-454e-885e-ea6aab2bb288/presignedurl",
"/v1/files/55af1e60-0f28-454e-885e-ea6aab2bb288/presignedurl",
nil,
)
if err != nil {
Expand All @@ -121,7 +121,7 @@ func TestGetFilePresignedURL(t *testing.T) {

if tc.fileFound {
assert(t, resp, &controller.GetFilePresignedURLResponse{
URL: "http://asd/v1/storage/files/55af1e60-0f28-454e-885e-ea6aab2bb288/presignedurl/content?this-is-the-signature", // nolint: lll
URL: "http://asd/v1/files/55af1e60-0f28-454e-885e-ea6aab2bb288/presignedurl/content?this-is-the-signature", // nolint: lll
Expiration: 30,
})
} else {
Expand Down
2 changes: 1 addition & 1 deletion controller/get_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func TestGetFile(t *testing.T) {
req, _ := http.NewRequestWithContext(
context.Background(),
"GET",
"/v1/storage/files/55af1e60-0f28-454e-885e-ea6aab2bb288",
"/v1/files/55af1e60-0f28-454e-885e-ea6aab2bb288",
nil,
)

Expand Down
2 changes: 1 addition & 1 deletion controller/list_broken_metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func TestListBrokenMetadata(t *testing.T) {

responseRecorder := httptest.NewRecorder()

req, _ := http.NewRequestWithContext(context.Background(), "POST", "/v1/storage/ops/list-broken-metadata", nil)
req, _ := http.NewRequestWithContext(context.Background(), "POST", "/v1/ops/list-broken-metadata", nil)

router.ServeHTTP(responseRecorder, req)

Expand Down
2 changes: 1 addition & 1 deletion controller/list_not_uploaded_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func TestListNotUploaded(t *testing.T) {

responseRecorder := httptest.NewRecorder()

req, _ := http.NewRequestWithContext(context.Background(), "POST", "/v1/storage/ops/list-not-uploaded", nil)
req, _ := http.NewRequestWithContext(context.Background(), "POST", "/v1/ops/list-not-uploaded", nil)

router.ServeHTTP(responseRecorder, req)

Expand Down
2 changes: 1 addition & 1 deletion controller/list_orphans_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestListOrphans(t *testing.T) {

responseRecorder := httptest.NewRecorder()

req, _ := http.NewRequestWithContext(context.Background(), "POST", "/v1/storage/ops/list-orphans", nil)
req, _ := http.NewRequestWithContext(context.Background(), "POST", "/v1/ops/list-orphans", nil)

router.ServeHTTP(responseRecorder, req)

Expand Down
2 changes: 1 addition & 1 deletion controller/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ info:
name: LICENSE-TBD
url: https://LICENSE-TBD
servers:
- url: http://{domain}:{port}/v1/storage
- url: http://{domain}:{port}/v1
description: The development API server
variables:
domain:
Expand Down
2 changes: 1 addition & 1 deletion controller/update_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func TestUpdateFile(t *testing.T) {

responseRecorder := httptest.NewRecorder()

req, _ := http.NewRequestWithContext(context.Background(), "PUT", "/v1/storage/files/"+file.md.ID, body)
req, _ := http.NewRequestWithContext(context.Background(), "PUT", "/v1/files/"+file.md.ID, body)

req.Header.Add("x-hasura-user-id", "some-valid-uuid")

Expand Down
2 changes: 1 addition & 1 deletion controller/upload_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func TestUploadFile(t *testing.T) {

responseRecorder := httptest.NewRecorder()

req, _ := http.NewRequestWithContext(context.Background(), "POST", "/v1/storage/files/", body)
req, _ := http.NewRequestWithContext(context.Background(), "POST", "/v1/files/", body)

req.Header.Set("Content-Type", contentType)

Expand Down

0 comments on commit b4b4fb4

Please sign in to comment.