1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

refactor: introduce repositories as an additional layer of abstraction to allow for better testability

This commit is contained in:
Ferdinand Mütsch
2020-11-01 16:56:36 +01:00
parent 96ff490d8d
commit 755cabb5f4
15 changed files with 458 additions and 265 deletions

View File

@ -124,7 +124,13 @@ func (h *SettingsHandler) DeleteCustomRule(w http.ResponseWriter, r *http.Reques
ID: uint(ruleId),
UserID: user.ID,
}
h.customRuleSrvc.Delete(rule)
err = h.customRuleSrvc.Delete(rule)
if err != nil {
respondAlert(w, "internal server error", "", conf.SettingsTemplate, http.StatusInternalServerError)
return
}
msg := url.QueryEscape("Custom rule deleted successfully.")
http.Redirect(w, r, fmt.Sprintf("%s/settings?success=%s", h.config.Server.BasePath, msg), http.StatusFound)