func updatePurchaseProductOnQuantity(w http.ResponseWriter, r *http.Request) errors.Http { pp := models.PurchaseProduct{} if err := FillPurchaseProductIdWithUrlValue(&pp, r.URL.Query()); err != nil { return errors.BadRequest(err.Error()) } quantity, err := strconv.Atoi(r.URL.Query().Get("quantity")) if err != nil { errors.BadRequest(err.Error()) } if err := pp.UpdateQuantity(db, quantity); err != nil { return errors.InternalServerError(err.Error()) } rend.JSON(w, http.StatusOK, pp) return nil }