diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2025-10-11 21:06:36 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2025-10-11 21:06:36 +0530 |
commit | 997b038761b8dd606e4041d8c8dc8bbf6f036033 (patch) | |
tree | 156bab13e8c2566e67df43189a612b7cebccda14 /item/controller.go | |
parent | 99aee928a64649be75c4698b8e856e3ea05bc695 (diff) |
Removed Brand and added BrandName and Category as item fieldsv0.18.0
Diffstat (limited to 'item/controller.go')
-rw-r--r-- | item/controller.go | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/item/controller.go b/item/controller.go index bb2eb94..b68f2aa 100644 --- a/item/controller.go +++ b/item/controller.go @@ -24,77 +24,6 @@ import ( "strconv" ) -func handleGetBrandItems (ctx *gin.Context) { - id, err := strconv.ParseUint(ctx.Param("id"), 10, 64) - if err != nil { - ctx.Error(e.ErrInvalidID) - return - } - - var items []SavedItem - err = getBrandItems(&items, uint(id)) - if err != nil { - ctx.Error(err) - ctx.Abort() - return - } - - ctx.JSON(http.StatusOK, gin.H{ - "data": items, - }) -} - -func handleGetBrands (ctx *gin.Context) { - var brands []Brand - - err := getBrands(&brands) - if err != nil { - ctx.Error(err) - ctx.Abort() - return - } - - ctx.JSON(http.StatusOK, gin.H{ - "data": brands, - }) -} - -func handleSaveBrand (ctx *gin.Context) { - var brand Brand - ctx.Bind(&brand) - - err := brand.upsert() - if err != nil { - ctx.Error(err) - ctx.Abort() - return - } - - ctx.JSON(http.StatusOK, gin.H{ - "data": brand, - }) -} - -func handleDelBrand (ctx *gin.Context) { - id, err := strconv.ParseUint(ctx.Param("id"), 10, 64) - if err != nil { - ctx.Error(e.ErrInvalidID) - return - } - - var brand Brand - brand.ID = uint(id) - - err = brand.del() - if err != nil { - ctx.Error(err) - ctx.Abort() - return - } - - ctx.JSON(http.StatusOK, nil) -} - func handleGetItems (ctx *gin.Context) { var items []SavedItem |