From 1dad15698845d370e998f7cc5feb8aece3fab58f Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Wed, 16 Sep 2026 17:05:17 -0400 Subject: refactor: remove dead code, consolidate save/error handling, add lint gate --- internal/admin/api_drops.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'internal/admin/api_drops.go') diff --git a/internal/admin/api_drops.go b/internal/admin/api_drops.go index 3724a6c..4cb0ae9 100644 --- a/internal/admin/api_drops.go +++ b/internal/admin/api_drops.go @@ -15,7 +15,7 @@ func (s *AdminServer) handleDrops(w http.ResponseWriter, r *http.Request) { case http.MethodGet: tree, err := listYAMLTree(s.dataDir, "drops") if err != nil { - writeJSON(w, map[string]any{"error": err.Error()}) + failJSON(w, err.Error()) return } if tree == nil { @@ -44,17 +44,17 @@ func (s *AdminServer) handleDropByID(w http.ResponseWriter, r *http.Request) { switch r.Method { case http.MethodGet: - s.getDrop(w, r, id) + s.getDrop(w, id) case http.MethodPut: s.updateDrop(w, r, id) case http.MethodDelete: - s.deleteDrop(w, r, id) + s.deleteDrop(w, id) default: http.Error(w, `{"error":"method not allowed"}`, http.StatusMethodNotAllowed) } } -func (s *AdminServer) getDrop(w http.ResponseWriter, r *http.Request, id string) { +func (s *AdminServer) getDrop(w http.ResponseWriter, id string) { data, path, err := readYAMLFile(s.dataDir, "drops", id) if err != nil { http.Error(w, `{"error":"drop not found"}`, http.StatusNotFound) @@ -108,7 +108,7 @@ func (s *AdminServer) updateDrop(w http.ResponseWriter, r *http.Request, id stri writeJSON(w, m) } -func (s *AdminServer) deleteDrop(w http.ResponseWriter, r *http.Request, id string) { +func (s *AdminServer) deleteDrop(w http.ResponseWriter, id string) { _, path, err := readYAMLFile(s.dataDir, "drops", id) if err != nil { http.Error(w, `{"error":"drop not found"}`, http.StatusNotFound) -- cgit v1.2.3