DELETE /admin/api/v1/colorpatterns Body: {"name": "patternName"}
(w http.ResponseWriter, r *http.Request)
| 75 | // DELETE /admin/api/v1/colorpatterns |
| 76 | // Body: {"name": "patternName"} |
| 77 | func apiV1DeleteColorPattern(w http.ResponseWriter, r *http.Request) { |
| 78 | var body struct { |
| 79 | Name string `json:"name"` |
| 80 | } |
| 81 | if err := json.NewDecoder(r.Body).Decode(&body); err != nil { |
| 82 | writeAPIError(w, http.StatusBadRequest, "malformed request body: "+err.Error()) |
| 83 | return |
| 84 | } |
| 85 | if body.Name == "" { |
| 86 | writeAPIError(w, http.StatusBadRequest, "name is required") |
| 87 | return |
| 88 | } |
| 89 | if err := colorpatterns.DeleteColorPattern(body.Name); err != nil { |
| 90 | writeAPIError(w, http.StatusInternalServerError, err.Error()) |
| 91 | return |
| 92 | } |
| 93 | writeJSON(w, http.StatusOK, APIResponse[struct{}]{Success: true}) |
| 94 | } |
nothing calls this directly
no test coverage detected