(w http.ResponseWriter, r *http.Request)
| 112 | } |
| 113 | |
| 114 | func (h *handler) deleteProduct(w http.ResponseWriter, r *http.Request) { |
| 115 | id := chi.URLParam(r, "id") |
| 116 | i, err := strconv.ParseInt(id, 10, 64) |
| 117 | if err != nil { |
| 118 | http.Error(w, "error parsing ID", http.StatusBadRequest) |
| 119 | return |
| 120 | } |
| 121 | |
| 122 | _, err = h.client.DeleteProduct(h.ctx, &pb.ProductReq{Id: i}) |
| 123 | if err != nil { |
| 124 | http.Error(w, "error deleting product", http.StatusInternalServerError) |
| 125 | return |
| 126 | } |
| 127 | |
| 128 | w.WriteHeader(http.StatusNoContent) |
| 129 | } |
| 130 | |
| 131 | func (h *handler) createOrder(w http.ResponseWriter, r *http.Request) { |
| 132 | var o OrderReq |
nothing calls this directly
no test coverage detected