22 lines
522 B
Go
22 lines
522 B
Go
package api
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"dana/internal/storage"
|
|
)
|
|
|
|
func (a *API) bookingAvailability(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Cache-Control", "no-store")
|
|
if !a.onecAutonomousEnabled() || !a.store.OnecFresh(r.Context(), onecStaleAfter) {
|
|
ok(w, map[string]any{"enabled": false, "days": []storage.BookingDay{}}, nil)
|
|
return
|
|
}
|
|
days, err := a.store.PublicBookingDays(r.Context())
|
|
if err != nil {
|
|
handleErr(w, err)
|
|
return
|
|
}
|
|
ok(w, map[string]any{"enabled": true, "days": days}, nil)
|
|
}
|