CHANGE: Minor improvements + updated api docs

This commit is contained in:
2025-02-28 13:10:44 +01:00
parent 23cb312644
commit dafcd95428
8 changed files with 561 additions and 345 deletions

View File

@@ -11,10 +11,11 @@ import (
//
// in DEBUG == "true" everything is set to "*" so that no cors errors will be happen
func SetCors(w http.ResponseWriter) {
if os.Getenv("DEBUG") == "true" {
if os.Getenv("NO_CORS") == "true" {
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Methods", "*")
w.Header().Set("Access-Control-Allow-Headers", "*")
// log.Println("Setting cors to *")
}
}

View File

@@ -203,7 +203,7 @@ func checkLastBooking(b Booking) bool {
log.Println("Error checking last booking: ", err)
return false
}
if int16(check_in_out) == b.CheckInOut {
if int16(check_in_out)%2 == b.CheckInOut%2 {
return false
}
return true

View File

@@ -7,8 +7,8 @@ import (
)
type WorkDay struct {
Day time.Time
Bookings []Booking
Day time.Time `json:"day"`
Bookings []Booking `json:"bookings"`
workTime time.Duration
pauseTime time.Duration
}