teg/backend/user_unit_lookups.go
2026-05-28 15:06:37 +02:00

22 lines
548 B
Go

// backend\user_unit_lookups.go
package main
import "net/http"
func (s *Server) handleListUserUnits(w http.ResponseWriter, r *http.Request) {
units, err := listDeviceLookupOptions(r.Context(), s.db, "user_units")
if err != nil {
writeError(w, http.StatusInternalServerError, "Einheiten konnten nicht geladen werden")
return
}
writeJSON(w, http.StatusOK, map[string]any{
"units": units,
})
}
func (s *Server) handleCreateUserUnit(w http.ResponseWriter, r *http.Request) {
s.handleCreateDeviceLookup(w, r, "user_units", "Einheit")
}