cleanup/small refactor + first tests

This commit is contained in:
2025-07-17 19:28:21 +02:00
parent 6688128d30
commit 68000a0f0a
6 changed files with 99 additions and 61 deletions

View File

@@ -34,16 +34,16 @@ func TimeHandler(w http.ResponseWriter, r *http.Request) {
}
}
func parseTimestamp(r *http.Request, get_key string, fallback string) (time.Time, error) {
_timestamp_get := r.URL.Query().Get(get_key)
if _timestamp_get == "" {
_timestamp_get = fallback
func parseTimestamp(r *http.Request, getKey string, fallback string) (time.Time, error) {
getTimestamp := r.URL.Query().Get(getKey)
if getTimestamp == "" {
getTimestamp = fallback
}
timestamp_get, err := time.Parse("2006-01-02", _timestamp_get)
Timestamp, err := time.Parse("2006-01-02", getTimestamp)
if err != nil {
return time.Now(), err
}
return timestamp_get, nil
return Timestamp, nil
}
// Returns bookings from DB with similar card uid -> checks for card uid in http query params