Added tests, shift 'delete'. Fixed overnight shifts, sync, error handling.

This commit is contained in:
Pen Anderson 2026-03-03 12:50:24 -06:00
parent c9180490a4
commit f2aa04db15
20 changed files with 2521 additions and 39 deletions

View file

@ -1,6 +1,7 @@
package main
import (
"errors"
"net/http"
"strconv"
)
@ -87,15 +88,12 @@ func (app *App) handleKioskClaim(w http.ResponseWriter, r *http.Request) {
writeError(w, "shift not found", http.StatusNotFound)
return
}
if shift.Capacity > 0 {
count, _ := app.shiftAssignedCount(shiftID)
if count >= shift.Capacity {
if err := app.assignShiftWithCapacity(v.ID, shiftID, shift.Capacity); err != nil {
if errors.Is(err, errShiftFull) {
writeError(w, "shift is full", http.StatusConflict)
return
}
}
if err := app.assignShift(v.ID, shiftID); err != nil {
writeError(w, err.Error(), http.StatusInternalServerError)
return
}