MCPcopy
hub / github.com/shadow1ng/fscan / Delete

Method Delete

web/api/project.go:256–273  ·  view source on GitHub ↗

Delete 删除项目

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

254
255// Delete 删除项目
256func (h *ProjectHandler) Delete(w http.ResponseWriter, r *http.Request) {
257 if r.Method != http.MethodPost {
258 http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
259 return
260 }
261 var req struct {
262 ID string `json:"id"`
263 }
264 if err := json.NewDecoder(r.Body).Decode(&req); err != nil || req.ID == "" {
265 writeJSON(w, http.StatusBadRequest, map[string]string{"error": "id is required"})
266 return
267 }
268 if err := h.store.Delete(req.ID); err != nil {
269 writeJSON(w, http.StatusInternalServerError, map[string]string{"error": err.Error()})
270 return
271 }
272 writeJSON(w, http.StatusOK, map[string]string{"status": "deleted"})
273}
274
275// Cache 查看项目缓存摘要
276func (h *ProjectHandler) Cache(w http.ResponseWriter, r *http.Request) {

Callers

nothing calls this directly

Calls 3

writeJSONFunction · 0.85
ErrorMethod · 0.45
DeleteMethod · 0.45

Tested by

no test coverage detected