summaryrefslogtreecommitdiff
path: root/brand
diff options
context:
space:
mode:
Diffstat (limited to 'brand')
-rw-r--r--brand/brand_router.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/brand/brand_router.go b/brand/brand_router.go
index 3930931..74432dd 100644
--- a/brand/brand_router.go
+++ b/brand/brand_router.go
@@ -17,10 +17,24 @@ func Routes(route *gin.Engine) {
err := x.Save()
if err != nil {
ctx.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
+ log.Printf("ERROR: Failed to add new brand \"%s\": %v", x.Name, err.Error())
}
log.Println("Added new brand to database: ", x.Name)
ctx.JSON(http.StatusOK, nil)
})
+
+ b.DELETE("/", func(ctx *gin.Context) {
+ var x brand.Brand
+ ctx.Bind(&x)
+ err := x.Delete()
+ if err != nil {
+ ctx.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
+ log.Printf("ERROR: Failed to delete brand \"%s\": %v", x.Name, err.Error())
+ }
+
+ log.Println("Delete brand: ", x.Name)
+ ctx.JSON(http.StatusOK, nil)
+ })
}
}