diff --git a/app/delivery/web/api/restricted/storage.go b/app/delivery/web/api/restricted/storage.go index 3760547..b851f9a 100644 --- a/app/delivery/web/api/restricted/storage.go +++ b/app/delivery/web/api/restricted/storage.go @@ -27,13 +27,13 @@ func NewStorageHandler() *StorageHandler { func StorageHandlerRoutes(r fiber.Router) fiber.Router { handler := NewStorageHandler() - r.Get("/list-content", handler.ListContent) - r.Get("/download-file", handler.DownloadFile) + r.Get("/list-content/*", handler.ListContent) + r.Get("/download-file/*", handler.DownloadFile) - r.Post("/upload-file", handler.UploadFile) - r.Get("/create-folder", handler.CreateFolder) - r.Delete("/delete-file", handler.DeleteFile) - r.Delete("/delete-folder", handler.DeleteFolder) + r.Post("/upload-file/*", handler.UploadFile) + r.Get("/create-folder/*", handler.CreateFolder) + r.Delete("/delete-file/*", handler.DeleteFile) + r.Delete("/delete-folder/*", handler.DeleteFolder) return r } @@ -41,7 +41,7 @@ func StorageHandlerRoutes(r fiber.Router) fiber.Router { // accepted path looks like e.g. "/folder1/" or "folder1" func (h *StorageHandler) ListContent(c fiber.Ctx) error { // relative path defaults to root directory - abs_path, err := h.storageService.AbsPath(h.config.Storage.RootFolder, c.Query("path")) + abs_path, err := h.storageService.AbsPath(h.config.Storage.RootFolder, c.Params("*")) if err != nil { return c.Status(responseErrors.GetErrorStatus(err)). JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err))) @@ -58,7 +58,7 @@ func (h *StorageHandler) ListContent(c fiber.Ctx) error { } func (h *StorageHandler) DownloadFile(c fiber.Ctx) error { - abs_path, err := h.storageService.AbsPath(h.config.Storage.RootFolder, c.Query("path")) + abs_path, err := h.storageService.AbsPath(h.config.Storage.RootFolder, c.Params("*")) if err != nil { return c.Status(responseErrors.GetErrorStatus(err)). JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err))) @@ -72,11 +72,12 @@ func (h *StorageHandler) DownloadFile(c fiber.Ctx) error { c.Attachment(filename) c.Set("Content-Length", strconv.FormatInt(filesize, 10)) + c.Set("Content-Type", "application/octet-stream") return c.SendStream(f, int(filesize)) } func (h *StorageHandler) UploadFile(c fiber.Ctx) error { - abs_path, err := h.storageService.AbsPath(h.config.Storage.RootFolder, c.Query("path")) + abs_path, err := h.storageService.AbsPath(h.config.Storage.RootFolder, c.Params("*")) if err != nil { return c.Status(responseErrors.GetErrorStatus(err)). JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err))) @@ -98,7 +99,7 @@ func (h *StorageHandler) UploadFile(c fiber.Ctx) error { } func (h *StorageHandler) CreateFolder(c fiber.Ctx) error { - abs_path, err := h.storageService.AbsPath(h.config.Storage.RootFolder, c.Query("path")) + abs_path, err := h.storageService.AbsPath(h.config.Storage.RootFolder, c.Params("*")) if err != nil { return c.Status(responseErrors.GetErrorStatus(err)). JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err))) @@ -114,7 +115,7 @@ func (h *StorageHandler) CreateFolder(c fiber.Ctx) error { } func (h *StorageHandler) DeleteFile(c fiber.Ctx) error { - abs_path, err := h.storageService.AbsPath(h.config.Storage.RootFolder, c.Query("path")) + abs_path, err := h.storageService.AbsPath(h.config.Storage.RootFolder, c.Params("*")) if err != nil { return c.Status(responseErrors.GetErrorStatus(err)). JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err))) @@ -130,7 +131,7 @@ func (h *StorageHandler) DeleteFile(c fiber.Ctx) error { } func (h *StorageHandler) DeleteFolder(c fiber.Ctx) error { - abs_path, err := h.storageService.AbsPath(h.config.Storage.RootFolder, c.Query("path")) + abs_path, err := h.storageService.AbsPath(h.config.Storage.RootFolder, c.Params("*")) if err != nil { return c.Status(responseErrors.GetErrorStatus(err)). JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, err))) diff --git a/bruno/b2b-daniel/.gitignore b/bruno/b2b_daniel/.gitignore similarity index 100% rename from bruno/b2b-daniel/.gitignore rename to bruno/b2b_daniel/.gitignore diff --git a/bruno/b2b_daniel/auth/folder.yml b/bruno/b2b_daniel/auth/folder.yml new file mode 100644 index 0000000..120ac3e --- /dev/null +++ b/bruno/b2b_daniel/auth/folder.yml @@ -0,0 +1,7 @@ +info: + name: auth + type: folder + seq: 1 + +request: + auth: inherit diff --git a/bruno/b2b-daniel/update-choice.yml b/bruno/b2b_daniel/auth/update-choice.yml similarity index 97% rename from bruno/b2b-daniel/update-choice.yml rename to bruno/b2b_daniel/auth/update-choice.yml index 3cd6ece..0a511b0 100644 --- a/bruno/b2b-daniel/update-choice.yml +++ b/bruno/b2b_daniel/auth/update-choice.yml @@ -1,7 +1,7 @@ info: name: update-choice type: http - seq: 6 + seq: 1 http: method: POST diff --git a/bruno/b2b-daniel/add-new-cart.yml b/bruno/b2b_daniel/carts/add-new-cart.yml similarity index 95% rename from bruno/b2b-daniel/add-new-cart.yml rename to bruno/b2b_daniel/carts/add-new-cart.yml index 1b6cbde..20199cf 100644 --- a/bruno/b2b-daniel/add-new-cart.yml +++ b/bruno/b2b_daniel/carts/add-new-cart.yml @@ -1,7 +1,7 @@ info: name: add-new-cart type: http - seq: 14 + seq: 1 http: method: GET diff --git a/bruno/b2b-daniel/add-product-to-cart (1).yml b/bruno/b2b_daniel/carts/add-product-to-cart (1).yml similarity index 97% rename from bruno/b2b-daniel/add-product-to-cart (1).yml rename to bruno/b2b_daniel/carts/add-product-to-cart (1).yml index bf5252b..eb7a5a1 100644 --- a/bruno/b2b-daniel/add-product-to-cart (1).yml +++ b/bruno/b2b_daniel/carts/add-product-to-cart (1).yml @@ -1,7 +1,7 @@ info: name: add-product-to-cart (1) type: http - seq: 19 + seq: 1 http: method: GET diff --git a/bruno/b2b-daniel/add-product-to-cart.yml b/bruno/b2b_daniel/carts/add-product-to-cart.yml similarity index 98% rename from bruno/b2b-daniel/add-product-to-cart.yml rename to bruno/b2b_daniel/carts/add-product-to-cart.yml index 045c7b0..ff780c1 100644 --- a/bruno/b2b-daniel/add-product-to-cart.yml +++ b/bruno/b2b_daniel/carts/add-product-to-cart.yml @@ -1,7 +1,7 @@ info: name: add-product-to-cart type: http - seq: 18 + seq: 14 http: method: GET diff --git a/bruno/b2b-daniel/change-cart-name.yml b/bruno/b2b_daniel/carts/change-cart-name.yml similarity index 97% rename from bruno/b2b-daniel/change-cart-name.yml rename to bruno/b2b_daniel/carts/change-cart-name.yml index ced76f1..08838dc 100644 --- a/bruno/b2b-daniel/change-cart-name.yml +++ b/bruno/b2b_daniel/carts/change-cart-name.yml @@ -1,7 +1,7 @@ info: name: change-cart-name type: http - seq: 15 + seq: 1 http: method: GET diff --git a/bruno/b2b_daniel/carts/folder.yml b/bruno/b2b_daniel/carts/folder.yml new file mode 100644 index 0000000..4f51dfd --- /dev/null +++ b/bruno/b2b_daniel/carts/folder.yml @@ -0,0 +1,7 @@ +info: + name: carts + type: folder + seq: 7 + +request: + auth: inherit diff --git a/bruno/b2b-daniel/retrieve-cart.yml b/bruno/b2b_daniel/carts/retrieve-cart.yml similarity index 96% rename from bruno/b2b-daniel/retrieve-cart.yml rename to bruno/b2b_daniel/carts/retrieve-cart.yml index 8316965..69c5e2e 100644 --- a/bruno/b2b-daniel/retrieve-cart.yml +++ b/bruno/b2b_daniel/carts/retrieve-cart.yml @@ -1,7 +1,7 @@ info: name: retrieve-cart type: http - seq: 17 + seq: 1 http: method: GET diff --git a/bruno/b2b-daniel/retrieve-carts-info.yml b/bruno/b2b_daniel/carts/retrieve-carts-info.yml similarity index 96% rename from bruno/b2b-daniel/retrieve-carts-info.yml rename to bruno/b2b_daniel/carts/retrieve-carts-info.yml index 8d76d52..479be4e 100644 --- a/bruno/b2b-daniel/retrieve-carts-info.yml +++ b/bruno/b2b_daniel/carts/retrieve-carts-info.yml @@ -1,7 +1,7 @@ info: name: retrieve-carts-info type: http - seq: 16 + seq: 1 http: method: GET diff --git a/bruno/b2b_daniel/langs-and-countries/folder.yml b/bruno/b2b_daniel/langs-and-countries/folder.yml new file mode 100644 index 0000000..b895323 --- /dev/null +++ b/bruno/b2b_daniel/langs-and-countries/folder.yml @@ -0,0 +1,7 @@ +info: + name: langs-and-countries + type: folder + seq: 4 + +request: + auth: inherit diff --git a/bruno/b2b-daniel/get_countries.yml b/bruno/b2b_daniel/langs-and-countries/get_countries.yml similarity index 96% rename from bruno/b2b-daniel/get_countries.yml rename to bruno/b2b_daniel/langs-and-countries/get_countries.yml index 07fed01..b7204b4 100644 --- a/bruno/b2b-daniel/get_countries.yml +++ b/bruno/b2b_daniel/langs-and-countries/get_countries.yml @@ -1,7 +1,7 @@ info: name: get_countries type: http - seq: 7 + seq: 1 http: method: GET diff --git a/bruno/b2b_daniel/list/folder.yml b/bruno/b2b_daniel/list/folder.yml new file mode 100644 index 0000000..52fa517 --- /dev/null +++ b/bruno/b2b_daniel/list/folder.yml @@ -0,0 +1,7 @@ +info: + name: list + type: folder + seq: 3 + +request: + auth: inherit diff --git a/bruno/b2b-daniel/list-products.yml b/bruno/b2b_daniel/list/list-products.yml similarity index 97% rename from bruno/b2b-daniel/list-products.yml rename to bruno/b2b_daniel/list/list-products.yml index 8fed3db..adc88a7 100644 --- a/bruno/b2b-daniel/list-products.yml +++ b/bruno/b2b_daniel/list/list-products.yml @@ -1,7 +1,7 @@ info: name: list-products type: http - seq: 4 + seq: 1 http: method: GET diff --git a/bruno/b2b-daniel/list-users.yml b/bruno/b2b_daniel/list/list-users.yml similarity index 97% rename from bruno/b2b-daniel/list-users.yml rename to bruno/b2b_daniel/list/list-users.yml index 4e435aa..85d70fa 100644 --- a/bruno/b2b-daniel/list-users.yml +++ b/bruno/b2b_daniel/list/list-users.yml @@ -1,7 +1,7 @@ info: name: list-users type: http - seq: 5 + seq: 1 http: method: GET diff --git a/bruno/b2b_daniel/menu/folder.yml b/bruno/b2b_daniel/menu/folder.yml new file mode 100644 index 0000000..32bc162 --- /dev/null +++ b/bruno/b2b_daniel/menu/folder.yml @@ -0,0 +1,7 @@ +info: + name: menu + type: folder + seq: 5 + +request: + auth: inherit diff --git a/bruno/b2b-daniel/get-breadcrumb.yml b/bruno/b2b_daniel/menu/get-breadcrumb.yml similarity index 97% rename from bruno/b2b-daniel/get-breadcrumb.yml rename to bruno/b2b_daniel/menu/get-breadcrumb.yml index 9a49428..a805790 100644 --- a/bruno/b2b-daniel/get-breadcrumb.yml +++ b/bruno/b2b_daniel/menu/get-breadcrumb.yml @@ -1,7 +1,7 @@ info: name: get-breadcrumb type: http - seq: 20 + seq: 1 http: method: GET diff --git a/bruno/b2b-daniel/get-category-tree.yml b/bruno/b2b_daniel/menu/get-category-tree.yml similarity index 97% rename from bruno/b2b-daniel/get-category-tree.yml rename to bruno/b2b_daniel/menu/get-category-tree.yml index b81d6d1..6e9d875 100644 --- a/bruno/b2b-daniel/get-category-tree.yml +++ b/bruno/b2b_daniel/menu/get-category-tree.yml @@ -1,7 +1,7 @@ info: name: get-category-tree type: http - seq: 8 + seq: 1 http: method: GET diff --git a/bruno/b2b-daniel/opencollection.yml b/bruno/b2b_daniel/opencollection.yml similarity index 100% rename from bruno/b2b-daniel/opencollection.yml rename to bruno/b2b_daniel/opencollection.yml diff --git a/bruno/b2b_daniel/product-translation/folder.yml b/bruno/b2b_daniel/product-translation/folder.yml new file mode 100644 index 0000000..cda7116 --- /dev/null +++ b/bruno/b2b_daniel/product-translation/folder.yml @@ -0,0 +1,7 @@ +info: + name: product-translation + type: folder + seq: 2 + +request: + auth: inherit diff --git a/bruno/b2b-daniel/get-product-description.yml b/bruno/b2b_daniel/product-translation/get-product-description.yml similarity index 100% rename from bruno/b2b-daniel/get-product-description.yml rename to bruno/b2b_daniel/product-translation/get-product-description.yml diff --git a/bruno/b2b-daniel/save-product-description.yml b/bruno/b2b_daniel/product-translation/save-product-description.yml similarity index 99% rename from bruno/b2b-daniel/save-product-description.yml rename to bruno/b2b_daniel/product-translation/save-product-description.yml index eb3fb26..201f4f8 100644 --- a/bruno/b2b-daniel/save-product-description.yml +++ b/bruno/b2b_daniel/product-translation/save-product-description.yml @@ -1,7 +1,7 @@ info: name: save-product-description type: http - seq: 3 + seq: 25 http: method: POST diff --git a/bruno/b2b-daniel/translate-product-description.yml b/bruno/b2b_daniel/product-translation/translate-product-description.yml similarity index 98% rename from bruno/b2b-daniel/translate-product-description.yml rename to bruno/b2b_daniel/product-translation/translate-product-description.yml index 2e8a7b4..12c65b4 100644 --- a/bruno/b2b-daniel/translate-product-description.yml +++ b/bruno/b2b_daniel/product-translation/translate-product-description.yml @@ -1,7 +1,7 @@ info: name: translate-product-description type: http - seq: 2 + seq: 24 http: method: GET diff --git a/bruno/b2b-daniel/create-index.yml b/bruno/b2b_daniel/search/create-index.yml similarity index 65% rename from bruno/b2b-daniel/create-index.yml rename to bruno/b2b_daniel/search/create-index.yml index 6f00a56..1469dc4 100644 --- a/bruno/b2b-daniel/create-index.yml +++ b/bruno/b2b_daniel/search/create-index.yml @@ -1,11 +1,11 @@ info: name: create-index type: http - seq: 10 + seq: 1 http: method: GET - url: http://localhost:3000/api/v1/restricted/meili-search/create-index + url: http://localhost:3000/api/v1/restricted/search/create-index auth: inherit settings: diff --git a/bruno/b2b_daniel/search/folder.yml b/bruno/b2b_daniel/search/folder.yml new file mode 100644 index 0000000..7b92aae --- /dev/null +++ b/bruno/b2b_daniel/search/folder.yml @@ -0,0 +1,7 @@ +info: + name: search + type: folder + seq: 6 + +request: + auth: inherit diff --git a/bruno/b2b-daniel/get-indexes.yml b/bruno/b2b_daniel/search/get-indexes.yml similarity index 96% rename from bruno/b2b-daniel/get-indexes.yml rename to bruno/b2b_daniel/search/get-indexes.yml index ebca4aa..0b85acf 100644 --- a/bruno/b2b-daniel/get-indexes.yml +++ b/bruno/b2b_daniel/search/get-indexes.yml @@ -1,7 +1,7 @@ info: name: get-indexes type: http - seq: 12 + seq: 1 http: method: GET diff --git a/bruno/b2b-daniel/remove-index.yml b/bruno/b2b_daniel/search/remove-index.yml similarity index 96% rename from bruno/b2b-daniel/remove-index.yml rename to bruno/b2b_daniel/search/remove-index.yml index 6ee9ebb..c1c8856 100644 --- a/bruno/b2b-daniel/remove-index.yml +++ b/bruno/b2b_daniel/search/remove-index.yml @@ -1,7 +1,7 @@ info: name: remove-index type: http - seq: 11 + seq: 1 http: method: DELETE diff --git a/bruno/b2b-daniel/search.yml b/bruno/b2b_daniel/search/search.yml similarity index 75% rename from bruno/b2b-daniel/search.yml rename to bruno/b2b_daniel/search/search.yml index 16cb913..5200d85 100644 --- a/bruno/b2b-daniel/search.yml +++ b/bruno/b2b_daniel/search/search.yml @@ -1,11 +1,11 @@ info: name: search type: http - seq: 13 + seq: 1 http: method: GET - url: http://localhost:3000/api/v1/restricted/meili-search/search?query=w&limit=4&id_category=0&price_lower_bound=60.0&price_upper_bound=70.0 + url: http://localhost:3000/api/v1/restricted/search/search?query=w&limit=4&id_category=0&price_lower_bound=60.0&price_upper_bound=70.0 params: - name: query value: w diff --git a/bruno/b2b-daniel/test.yml b/bruno/b2b_daniel/search/test.yml similarity index 67% rename from bruno/b2b-daniel/test.yml rename to bruno/b2b_daniel/search/test.yml index 0b73d2f..60fe55a 100644 --- a/bruno/b2b-daniel/test.yml +++ b/bruno/b2b_daniel/search/test.yml @@ -1,11 +1,11 @@ info: name: test type: http - seq: 9 + seq: 1 http: method: GET - url: http://localhost:3000/api/v1/restricted/meili-search/test + url: http://localhost:3000/api/v1/restricted/search/test auth: inherit settings: diff --git a/bruno/b2b-daniel/create-folder.yml b/bruno/b2b_daniel/storage/create-folder.yml similarity index 77% rename from bruno/b2b-daniel/create-folder.yml rename to bruno/b2b_daniel/storage/create-folder.yml index 0f9fabb..1250965 100644 --- a/bruno/b2b-daniel/create-folder.yml +++ b/bruno/b2b_daniel/storage/create-folder.yml @@ -1,15 +1,12 @@ info: name: create-folder type: http - seq: 24 + seq: 1 http: method: GET - url: http://localhost:3000/api/v1/restricted/storage/create-folder?path=&name=folder + url: http://localhost:3000/api/v1/restricted/storage/create-folder?name=folder params: - - name: path - value: "" - type: query - name: name value: folder type: query diff --git a/bruno/b2b-daniel/delete-file.yml b/bruno/b2b_daniel/storage/delete-file.yml similarity index 67% rename from bruno/b2b-daniel/delete-file.yml rename to bruno/b2b_daniel/storage/delete-file.yml index 32f7104..01b1744 100644 --- a/bruno/b2b-daniel/delete-file.yml +++ b/bruno/b2b_daniel/storage/delete-file.yml @@ -1,15 +1,11 @@ info: name: delete-file type: http - seq: 25 + seq: 1 http: method: DELETE - url: http://localhost:3000/api/v1/restricted/storage/delete-file?path=/folder/test.txt - params: - - name: path - value: /folder/test.txt - type: query + url: http://localhost:3000/api/v1/restricted/storage/delete-file/folder1/TODO.txt auth: inherit settings: diff --git a/bruno/b2b-daniel/delete-folder.yml b/bruno/b2b_daniel/storage/delete-folder.yml similarity index 70% rename from bruno/b2b-daniel/delete-folder.yml rename to bruno/b2b_daniel/storage/delete-folder.yml index 49dacb7..3c578ce 100644 --- a/bruno/b2b-daniel/delete-folder.yml +++ b/bruno/b2b_daniel/storage/delete-folder.yml @@ -1,15 +1,11 @@ info: name: delete-folder type: http - seq: 26 + seq: 1 http: method: DELETE - url: http://localhost:3000/api/v1/restricted/storage/delete-folder?path=/folder/ - params: - - name: path - value: /folder/ - type: query + url: http://localhost:3000/api/v1/restricted/storage/delete-folder/folder/ auth: inherit settings: diff --git a/bruno/b2b-daniel/download-file.yml b/bruno/b2b_daniel/storage/download-file.yml similarity index 66% rename from bruno/b2b-daniel/download-file.yml rename to bruno/b2b_daniel/storage/download-file.yml index d400ef4..d6c65a1 100644 --- a/bruno/b2b-daniel/download-file.yml +++ b/bruno/b2b_daniel/storage/download-file.yml @@ -1,15 +1,11 @@ info: name: download-file type: http - seq: 22 + seq: 1 http: method: GET - url: http://localhost:3000/api/v1/restricted/storage/download-file?path=/folder1/test.txt - params: - - name: path - value: /folder1/test.txt - type: query + url: http://localhost:3000/api/v1/restricted/storage/download-file/folder1/test.xlsx auth: inherit settings: diff --git a/bruno/b2b_daniel/storage/folder.yml b/bruno/b2b_daniel/storage/folder.yml new file mode 100644 index 0000000..70062a4 --- /dev/null +++ b/bruno/b2b_daniel/storage/folder.yml @@ -0,0 +1,7 @@ +info: + name: storage + type: folder + seq: 1 + +request: + auth: inherit diff --git a/bruno/b2b-daniel/list-content.yml b/bruno/b2b_daniel/storage/list-content.yml similarity index 70% rename from bruno/b2b-daniel/list-content.yml rename to bruno/b2b_daniel/storage/list-content.yml index 972779f..ed67b6d 100644 --- a/bruno/b2b-daniel/list-content.yml +++ b/bruno/b2b_daniel/storage/list-content.yml @@ -1,15 +1,11 @@ info: name: list-content type: http - seq: 21 + seq: 1 http: method: GET - url: http://localhost:3000/api/v1/restricted/storage/list-content?path=/folder1 - params: - - name: path - value: /folder1 - type: query + url: http://localhost:3000/api/v1/restricted/storage/list-content/folder1 auth: inherit settings: diff --git a/bruno/b2b-daniel/upload-file.yml b/bruno/b2b_daniel/storage/upload-file.yml similarity index 67% rename from bruno/b2b-daniel/upload-file.yml rename to bruno/b2b_daniel/storage/upload-file.yml index 41ab47a..aa8d740 100644 --- a/bruno/b2b-daniel/upload-file.yml +++ b/bruno/b2b_daniel/storage/upload-file.yml @@ -1,22 +1,18 @@ info: name: upload-file type: http - seq: 23 + seq: 1 http: method: POST - url: http://localhost:3000/api/v1/restricted/storage/upload-file?path=folder/ - params: - - name: path - value: folder/ - type: query + url: http://localhost:3000/api/v1/restricted/storage/upload-file/folder1/ body: type: multipart-form data: - name: document type: file value: - - /home/daniel/coding/work/b2b/storage/folder1/test.txt + - /home/daniel/TODO.txt auth: inherit settings: