added user Session Handler --> closed #20

This commit is contained in:
2025-08-12 15:47:36 +02:00
parent 64bc58a3a5
commit a87bef8c89
13 changed files with 127 additions and 101 deletions

View File

@@ -20,17 +20,13 @@ func TimeHandler(w http.ResponseWriter, r *http.Request) {
switch r.Method {
case http.MethodGet:
getBookings(w, r)
break
case http.MethodPost:
updateBooking(w, r)
break
case http.MethodOptions:
// just support options header for non GET Requests from SWAGGER
w.WriteHeader(http.StatusOK)
break
default:
http.Error(w, "Method not allowed!", http.StatusMethodNotAllowed)
break
}
}
@@ -120,7 +116,6 @@ func updateBooking(w http.ResponseWriter, r *http.Request) {
if err != nil {
log.Println("Error inserting booking", err)
}
break
case "change":
absenceType, err := strconv.Atoi(r.FormValue("absence"))
if err != nil {
@@ -151,9 +146,7 @@ func updateBooking(w http.ResponseWriter, r *http.Request) {
booking.UpdateTime(parsedTime)
}
}
break
}
getBookings(w, r)
}