2024-10-14 23:00:46 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-10-23 22:16:51 +02:00
|
|
|
"log"
|
2024-10-14 23:00:46 +02:00
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (cfg *apiConfig) serveReset(w http.ResponseWriter, r *http.Request) {
|
|
|
|
cfg.fileserverHits.Store(0)
|
2024-10-23 22:16:51 +02:00
|
|
|
if cfg.Platform != "dev" {
|
|
|
|
log.Printf("Invalid %s platform !", cfg.Platform)
|
|
|
|
w.WriteHeader(http.StatusForbidden)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
_, err := cfg.DB.DeleteUser(r.Context())
|
|
|
|
if err != nil {
|
|
|
|
log.Printf("Error deleting users: %s", err)
|
|
|
|
}
|
2024-10-14 23:00:46 +02:00
|
|
|
}
|