add demo check

Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
Hadi
2026-04-11 22:29:06 +02:00
parent 86988d9afe
commit d29239cbb5

View File

@@ -137,6 +137,10 @@ func (h *SearchHandler) Get(w http.ResponseWriter, r *http.Request) {
// DELETE /searches/{id} // DELETE /searches/{id}
func (h *SearchHandler) Delete(w http.ResponseWriter, r *http.Request) { func (h *SearchHandler) Delete(w http.ResponseWriter, r *http.Request) {
if h.demo {
respond.Error(w, http.StatusForbidden, "demo mode: deletions are disabled")
return
}
id := chi.URLParam(r, "id") id := chi.URLParam(r, "id")
if err := h.manager.Delete(id); err != nil { if err := h.manager.Delete(id); err != nil {
respond.Error(w, http.StatusNotFound, err.Error()) respond.Error(w, http.StatusNotFound, err.Error())