package handlers import ( "MiauInv/storage" "encoding/json" "net/http" ) type StockRequest struct { ItemID int `json:"item_id"` LocationID int `json:"location_id"` Quantity int `json:"quantity"` } func AddStock(w http.ResponseWriter, r *http.Request) { var req StockRequest json.NewDecoder(r.Body).Decode(&req) _, err := storage.DB.Exec(` INSERT INTO stock(item_id,location_id,quantity) VALUES(?,?,?) `, req.ItemID, req.LocationID, req.Quantity, ) if err != nil { http.Error(w, err.Error(), 500) return } }