update backoffice
All checks were successful
Build and Publish / Metadata (push) Successful in 8s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 1m33s
Build and Publish / BuildAndDeployArm64 (push) Successful in 4m13s

This commit is contained in:
matst80
2025-10-15 08:47:05 +02:00
parent f543ed1d74
commit a1ba48053a
4 changed files with 287 additions and 248 deletions

View File

@@ -11,6 +11,9 @@ import (
"sort"
"strconv"
"strings"
"time"
"git.tornberg.me/go-cart-actor/pkg/cart"
)
type FileServer struct {
@@ -122,6 +125,12 @@ func (fs *FileServer) CartHandler(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusBadRequest, map[string]string{"error": "invalid id"})
return
}
// reconstruct state from event log if present
grain := cart.NewCartGrain(id, time.Now())
if globalDisk != nil {
_ = globalDisk.LoadEvents(id, grain)
}
path := filepath.Join(fs.dataDir, fmt.Sprintf("%d.events.log", id))
info, err := os.Stat(path)
if err != nil {
@@ -139,6 +148,7 @@ func (fs *FileServer) CartHandler(w http.ResponseWriter, r *http.Request) {
}
writeJSON(w, http.StatusOK, map[string]any{
"id": id,
"state": grain,
"rawLog": lines,
"meta": map[string]any{
"size": info.Size(),