Files
Codex Local bf1233d5df
ci / verify (push) Canceled after 0s
feat: expand companion platform, device controls, and memoir workflows
Add customer and operator login, BLE provisioning, device fleet controls, call memory, memoir generation, and refreshed family and maintenance portals. Include API contracts, migrations, firmware sources, tests, assets, and deployment documentation.
2026-10-08 10:06:44 +08:00

24 lines
685 B
Go

package httpapi
import (
"data-terminal-cloud/internal/webevents"
"net/http"
"time"
)
func WebEventHistoryHandler(service *webevents.Service) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
principal, ok := webPrincipal(w, r)
if !ok {
return
}
items, err := service.History(r.Context(), principal, time.Now().Add(-7*24*time.Hour), 200)
if err != nil {
WriteError(w, r, http.StatusInternalServerError, "INTERNAL_ERROR", "近期动态读取失败,请重试")
return
}
w.Header().Set("Cache-Control", "no-store")
WriteJSON(w, r, http.StatusOK, map[string]any{"items": items, "limit": 200, "retention_days": 7})
})
}