diff --git a/backend/internal/api/handlers/product.go b/backend/internal/api/handlers/product.go index 513e72a..8fe6338 100644 --- a/backend/internal/api/handlers/product.go +++ b/backend/internal/api/handlers/product.go @@ -236,6 +236,7 @@ func (h *ProductHandler) Create(c *gin.Context) { Name: req.Name, Description: req.Description, Price: req.Price, + Weight: req.Weight, MinPurchase: req.MinPurchase, MaxPurchase: req.MaxPurchase, MinWeight: req.MinWeight, @@ -299,6 +300,9 @@ func (h *ProductHandler) Update(c *gin.Context) { if req.Price != nil { updates["price"] = *req.Price } + if req.Weight != nil { + updates["weight"] = *req.Weight + } if req.MinPurchase != nil { updates["min_purchase"] = *req.MinPurchase } diff --git a/backend/internal/schemas/product.go b/backend/internal/schemas/product.go index 1a3b2b2..9cfd4e0 100644 --- a/backend/internal/schemas/product.go +++ b/backend/internal/schemas/product.go @@ -30,6 +30,7 @@ type CreateProductRequest struct { Name string `json:"name" binding:"required"` Description string `json:"description"` Price float64 `json:"price" binding:"gte=0"` + Weight float64 `json:"weight"` MinPurchase int `json:"min_purchase"` MaxPurchase *int `json:"max_purchase"` MinWeight *float64 `json:"min_weight"` @@ -49,6 +50,7 @@ type UpdateProductRequest struct { Name *string `json:"name"` Description *string `json:"description"` Price *float64 `json:"price"` + Weight *float64 `json:"weight"` MinPurchase *int `json:"min_purchase"` MaxPurchase *int `json:"max_purchase"` MinWeight *float64 `json:"min_weight"`