Bugfixes
This commit is contained in:
@@ -34,7 +34,7 @@ func (pgc *ProductGroupController) CreateProductGroup(c *gin.Context) {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, createdProductGroup)
|
||||
c.JSON(http.StatusOK, gin.H{"message": "ProductGroup created", "data": createdProductGroup})
|
||||
}
|
||||
|
||||
func (pgc *ProductGroupController) UpdateProductGroup(c *gin.Context) {
|
||||
@@ -48,7 +48,7 @@ func (pgc *ProductGroupController) UpdateProductGroup(c *gin.Context) {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, updatedProductGroup)
|
||||
c.JSON(http.StatusOK, gin.H{"message": "ProductGroup updated", "data": updatedProductGroup})
|
||||
}
|
||||
|
||||
func (pgc *ProductGroupController) DeleteProductGroup(c *gin.Context) {
|
||||
@@ -76,7 +76,7 @@ func (pgc *ProductGroupController) GetProductGroup(c *gin.Context) {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, productGroup)
|
||||
c.JSON(http.StatusOK, gin.H{"message": "ProductGroup retrieved", "data": productGroup})
|
||||
}
|
||||
|
||||
func (pgc *ProductGroupController) GetProductGroupsByParentId(c *gin.Context) {
|
||||
@@ -90,16 +90,16 @@ func (pgc *ProductGroupController) GetProductGroupsByParentId(c *gin.Context) {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, productGroups)
|
||||
c.JSON(http.StatusOK, gin.H{"message": "ProductGroups retrieved", "data": productGroups})
|
||||
}
|
||||
|
||||
func (pgc *ProductGroupController) DeleteProductFromProductGroupId(c *gin.Context) {
|
||||
productId, err := strconv.Atoi(c.Param("productId"))
|
||||
productGroupId, err := strconv.Atoi(c.Param("productGroupId"))
|
||||
if err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid product ID"})
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid product group ID"})
|
||||
return
|
||||
}
|
||||
err = pgc.productGroupService.DeleteProductFromProductGroupId(productId)
|
||||
err = pgc.productGroupService.DeleteProductFromProductGroupId(productGroupId)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
@@ -118,7 +118,7 @@ func (pgc *ProductGroupController) GetPropertiesFromProductGroupId(c *gin.Contex
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, properties)
|
||||
c.JSON(http.StatusOK, gin.H{"message": "Properties retrieved", "data": properties})
|
||||
}
|
||||
|
||||
func (pgc *ProductGroupController) DeletePropertyFromProductGroupId(c *gin.Context) {
|
||||
@@ -158,5 +158,5 @@ func (pgc *ProductGroupController) CreatePropertyToProductGroupId(c *gin.Context
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, property2)
|
||||
c.JSON(http.StatusOK, gin.H{"message": "Property created", "data": property2})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user