Merge branch 'main' of git-ssh.tornberg.me:mats/go-cart-actor
Some checks failed
Build and Publish / Metadata (push) Successful in 9s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 1m5s
Build and Publish / BuildAndDeployArm64 (push) Has been cancelled

This commit is contained in:
matst80
2025-10-16 22:49:29 +02:00
3 changed files with 6 additions and 5 deletions

View File

@@ -10,7 +10,6 @@ import (
"net/http"
"os"
"path/filepath"
"regexp"
"sort"
"strconv"
"strings"
@@ -70,15 +69,15 @@ func isValidFileId(name string) (uint64, bool) {
// }
func appendFileInfo(info fs.FileInfo, out *CartFileInfo) *CartFileInfo {
sys := info.Sys()
fmt.Printf("sys type %T", sys)
//sys := info.Sys()
//fmt.Printf("sys type %T", sys)
out.Size = info.Size()
out.Modified = info.ModTime()
//out.Accessed, _ = AccessTime(info)
return out
}
var cartFileRe = regexp.MustCompile(`^(\d+)\.events\.log$`)
// var cartFileRe = regexp.MustCompile(`^(\d+)\.events\.log$`)
func listCartFiles(dir string) ([]*CartFileInfo, error) {
entries, err := os.ReadDir(dir)

View File

@@ -32,7 +32,7 @@ type ItemMeta struct {
type CartItem struct {
Id uint32 `json:"id"`
ItemId uint32 `json:"itemId,omitempty"`
ParentId uint32 `json:"parentId,omitempty"`
ParentId *uint32 `json:"parentId,omitempty"`
Sku string `json:"sku"`
Price Price `json:"price"`
TotalPrice Price `json:"totalPrice"`

View File

@@ -76,6 +76,8 @@ func AddItem(g *CartGrain, m *messages.AddItem) error {
SellerId: m.SellerId,
SellerName: m.SellerName,
},
SaleStatus: m.SaleStatus,
ParentId: m.ParentId,
Price: *pricePerItem,
TotalPrice: *MultiplyPrice(*pricePerItem, int64(m.Quantity)),