fix: batch tag queries, inline edit, delete response, SPA catch-all, link glyph
- Fix N+1 tag query in List() with batched IN clause
- Add inline body editing in web detail pane (dblclick or e key)
- Delete API returns {result: "soft"|"hard"} with 200 instead of 204
- SPA handler serves index.html for all extensionless paths
- Link glyph changed from emoji 🔗 to unicode ↗ for terminal alignment
- Capture bar contrast and hover glow increased
- Comment on load-bearing "--" in root.go
This commit is contained in:
@@ -214,10 +214,14 @@ func updateEntity(store *db.Store) http.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
type DeleteResponse struct {
|
||||
Result string `json:"result"`
|
||||
}
|
||||
|
||||
func deleteEntity(store *db.Store) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
id := chi.URLParam(r, "id")
|
||||
_, err := store.SoftDelete(id)
|
||||
result, err := store.SoftDelete(id)
|
||||
if err != nil {
|
||||
if err == db.ErrNotFound {
|
||||
writeError(w, http.StatusNotFound, "not_found", "no entity with id "+id)
|
||||
@@ -226,7 +230,11 @@ func deleteEntity(store *db.Store) http.HandlerFunc {
|
||||
writeError(w, http.StatusInternalServerError, "internal", err.Error())
|
||||
return
|
||||
}
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
label := "soft"
|
||||
if result == db.DeletedHard {
|
||||
label = "hard"
|
||||
}
|
||||
writeJSON(w, http.StatusOK, DeleteResponse{Result: label})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user