Deaktiviere das Löschen von Sprechstunden wegen Spam

This commit is contained in:
Gonne 2022-10-27 20:59:10 +02:00
parent 12a5080659
commit 8654263798
5 changed files with 15 additions and 8 deletions

View file

@ -3,7 +3,7 @@ package controllers
import (
"net/http"
"officeHours/models"
//"officeHours/models"
"officeHours/templating"
"strconv"
)
@ -12,16 +12,16 @@ func (b *BaseHandler) DeleteOfficeHourHandler(w http.ResponseWriter, req *http.R
// TODO: error handling here is by no means sufficient, furthermore
// 400 BadRequest is for technically wrong stuff (most promimently GET instead of POST)
if req.FormValue("id") != "" {
id, err := strconv.Atoi(req.FormValue("id"))
_, err := strconv.Atoi(req.FormValue("id"))
if err != nil {
w.WriteHeader(http.StatusBadRequest)
}
officeHour, err := b.officeHourRepo.FindById(id)
//officeHour, err := b.officeHourRepo.FindById(id)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
}
_, err = b.requestRepo.Add(officeHour, models.RequestDelete)
templating.ServeTemplate(w, "deleteSuccess", nil)
//_, err = b.requestRepo.Add(officeHour, models.RequestDelete)
templating.ServeTemplate(w, "deleteDisabled", nil)
} else {
officeHours, _ := b.officeHourRepo.GetAll(true)
timetable, slots := b.GetTimetable(officeHours)