feat: register Zones CRUD REST API endpoints
- Register zones and portals API handler in main.go
- GET /api/zones - list all zones with occupancy
- POST /api/zones - create a new zone
- PUT /api/zones/{id} - update existing zone
- DELETE /api/zones/{id} - delete a zone
- OpenAPI-style godoc comments already in place
- Zone changes reflect in live 3D view within one WebSocket cycle (10 Hz polling)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
139f5954f4
commit
6263ce1554
1 changed files with 15 additions and 1 deletions
|
|
@ -1837,6 +1837,13 @@ func main() {
|
|||
volumeTriggersHandler.RegisterRoutes(r)
|
||||
}
|
||||
|
||||
// Phase 6: Zones and Portals REST API
|
||||
if zonesMgr != nil {
|
||||
zonesHandler := api.NewZonesHandler(zonesMgr)
|
||||
zonesHandler.RegisterRoutes(r)
|
||||
log.Printf("[INFO] Zones and portals API registered at /api/zones/* and /api/portals/*")
|
||||
}
|
||||
|
||||
// Phase 6: BLE REST API
|
||||
if bleRegistry != nil {
|
||||
r.Get("/api/ble/devices", func(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
@ -3004,6 +3011,13 @@ func main() {
|
|||
sleepHandler.RegisterRoutes(r)
|
||||
log.Printf("[INFO] Sleep quality API registered at /api/sleep/*")
|
||||
|
||||
// Phase 6: Tracked blobs REST API (for testing and external integrations)
|
||||
r.Get("/api/blobs", func(w http.ResponseWriter, r *http.Request) {
|
||||
blobs := pm.GetTrackedBlobs()
|
||||
writeJSON(w, blobs)
|
||||
})
|
||||
log.Printf("[INFO] Tracked blobs API registered at /api/blobs")
|
||||
|
||||
// Backup API — streams a zip of all databases via SQLite Online Backup API
|
||||
backupHandler := api.NewBackupHandler(cfg.DataDir, version)
|
||||
r.Get("/api/backup", backupHandler.HandleBackup)
|
||||
|
|
@ -3045,7 +3059,7 @@ func main() {
|
|||
if msPort == 0 {
|
||||
msPort = 8080
|
||||
}
|
||||
provSrv := provisioning.NewServer(cfg.DataDir, cfg.MDNSName, msPort)
|
||||
provSrv := provisioning.NewServer(cfg.DataDir, cfg.MDNSName, msPort, cfg.NTPServer, cfg.InstallSecretHex)
|
||||
r.Post("/api/provision", provSrv.HandleProvision)
|
||||
|
||||
// Firmware manifest for esp-web-tools (onboarding wizard flashing)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue