added booking types + working on overtime
This commit is contained in:
@@ -50,8 +50,9 @@ func createBooking(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusAccepted)
|
||||
json.NewEncoder(w).Encode(booking)
|
||||
return
|
||||
}
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
http.Error(w, "Cannot verify booking, maybe missing a parameter", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
func verifyToken(r *http.Request) bool {
|
||||
|
||||
@@ -110,11 +110,11 @@ func updateBooking(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
newBooking := (*models.Booking).New(nil, user.CardUID, 0, int16(check_in_out))
|
||||
newBooking := (*models.Booking).New(nil, user.CardUID, 0, int16(check_in_out), 1)
|
||||
newBooking.Timestamp = timestamp
|
||||
err = newBooking.InsertWithTimestamp()
|
||||
if err != nil {
|
||||
log.Println("Error inserting booking", err)
|
||||
log.Printf("Error inserting booking %v -> %v\n", newBooking, err)
|
||||
}
|
||||
case "change":
|
||||
absenceType, err := strconv.Atoi(r.FormValue("absence"))
|
||||
|
||||
Reference in New Issue
Block a user