(w http.ResponseWriter, r *http.Request)
| 302 | } |
| 303 | |
| 304 | func (a *API) deactivateConfig(w http.ResponseWriter, r *http.Request) { |
| 305 | userID, _, err := users.ExtractTenantIDFromHTTPRequest(r) |
| 306 | if err != nil { |
| 307 | http.Error(w, err.Error(), http.StatusUnauthorized) |
| 308 | return |
| 309 | } |
| 310 | logger := util_log.WithContext(r.Context(), util_log.Logger) |
| 311 | |
| 312 | if err := a.db.DeactivateConfig(r.Context(), userID); err != nil { |
| 313 | if err == sql.ErrNoRows { |
| 314 | level.Info(logger).Log("msg", "deactivate config - no configuration", "userID", userID) |
| 315 | http.Error(w, "No configuration", http.StatusNotFound) |
| 316 | return |
| 317 | } |
| 318 | level.Error(logger).Log("msg", "error deactivating config", "err", err) |
| 319 | http.Error(w, err.Error(), http.StatusInternalServerError) |
| 320 | return |
| 321 | } |
| 322 | level.Info(logger).Log("msg", "config deactivated", "userID", userID) |
| 323 | w.WriteHeader(http.StatusOK) |
| 324 | } |
| 325 | |
| 326 | func (a *API) restoreConfig(w http.ResponseWriter, r *http.Request) { |
| 327 | userID, _, err := users.ExtractTenantIDFromHTTPRequest(r) |
nothing calls this directly
no test coverage detected