From 229f77f098f884d7593e5d2b8674582510c1d751 Mon Sep 17 00:00:00 2001 From: garrettladley Date: Sun, 4 Feb 2024 19:09:06 -0500 Subject: [PATCH] ghwf debugging | dynamic path id standardization --- backend/src/controllers/category.go | 6 +++--- backend/src/controllers/club.go | 6 +++--- backend/src/server/routes/category.go | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/backend/src/controllers/category.go b/backend/src/controllers/category.go index 317e312bc..c06eef82d 100644 --- a/backend/src/controllers/category.go +++ b/backend/src/controllers/category.go @@ -81,7 +81,7 @@ func (t *CategoryController) GetCategories(c *fiber.Ctx) error { // @Failure 500 {string} string "failed to retrieve category" // @Router /api/v1/category/{id} [get] func (t *CategoryController) GetCategory(c *fiber.Ctx) error { - category, err := t.categoryService.GetCategory(c.Params("id")) + category, err := t.categoryService.GetCategory(c.Params("categoryID")) if err != nil { return err.FiberError(c) } @@ -102,7 +102,7 @@ func (t *CategoryController) GetCategory(c *fiber.Ctx) error { // @Failure 500 {string} string "failed to delete category" // @Router /api/v1/category/{id} [delete] func (t *CategoryController) DeleteCategory(c *fiber.Ctx) error { - if err := t.categoryService.DeleteCategory(c.Params("id")); err != nil { + if err := t.categoryService.DeleteCategory(c.Params("categoryID")); err != nil { return err.FiberError(c) } @@ -128,7 +128,7 @@ func (t *CategoryController) UpdateCategory(c *fiber.Ctx) error { return errors.FailedToValidateCategory.FiberError(c) } - updatedCategory, err := t.categoryService.UpdateCategory(c.Params("id"), category) + updatedCategory, err := t.categoryService.UpdateCategory(c.Params("categoryID"), category) if err != nil { return err.FiberError(c) } diff --git a/backend/src/controllers/club.go b/backend/src/controllers/club.go index 567b8a83f..e9b3d433d 100644 --- a/backend/src/controllers/club.go +++ b/backend/src/controllers/club.go @@ -44,7 +44,7 @@ func (cl *ClubController) CreateClub(c *fiber.Ctx) error { } func (cl *ClubController) GetClub(c *fiber.Ctx) error { - club, err := cl.clubService.GetClub(c.Params("id")) + club, err := cl.clubService.GetClub(c.Params("clubID")) if err != nil { return err.FiberError(c) } @@ -59,7 +59,7 @@ func (cl *ClubController) UpdateClub(c *fiber.Ctx) error { return errors.FailedToParseRequestBody.FiberError(c) } - updatedClub, err := cl.clubService.UpdateClub(c.Params("id"), clubBody) + updatedClub, err := cl.clubService.UpdateClub(c.Params("clubID"), clubBody) if err != nil { return err.FiberError(c) } @@ -68,7 +68,7 @@ func (cl *ClubController) UpdateClub(c *fiber.Ctx) error { } func (cl *ClubController) DeleteClub(c *fiber.Ctx) error { - err := cl.clubService.DeleteClub(c.Params("id")) + err := cl.clubService.DeleteClub(c.Params("clubID")) if err != nil { return err.FiberError(c) } diff --git a/backend/src/server/routes/category.go b/backend/src/server/routes/category.go index dccdfbb57..1bffb59f2 100644 --- a/backend/src/server/routes/category.go +++ b/backend/src/server/routes/category.go @@ -13,9 +13,9 @@ func Category(router fiber.Router, categoryService services.CategoryServiceInter categories.Post("/", categoryController.CreateCategory) categories.Get("/", categoryController.GetCategories) - categories.Get("/:id", categoryController.GetCategory) - categories.Delete("/:id", categoryController.DeleteCategory) - categories.Patch("/:id", categoryController.UpdateCategory) + categories.Get("/:categoryID", categoryController.GetCategory) + categories.Delete("/:categoryID", categoryController.DeleteCategory) + categories.Patch("/:categoryID", categoryController.UpdateCategory) return categories }