add reservations to the model
All checks were successful
Build and Publish / BuildAndDeployAmd64 (push) Successful in 46s
Build and Publish / BuildAndDeployArm64 (push) Successful in 4m48s

This commit is contained in:
matst80
2025-11-26 19:25:20 +01:00
parent 95426acd4a
commit 400079ec98
8 changed files with 461 additions and 433 deletions

View File

@@ -44,6 +44,10 @@ func AddItem(g *CartGrain, m *messages.AddItem) error {
if existing.StoreId == nil && m.StoreId != nil {
existing.StoreId = m.StoreId
}
if m.ReservationEndTime != nil {
t := m.ReservationEndTime.AsTime()
existing.ReservationEndTime = &t
}
return nil
}
@@ -57,8 +61,7 @@ func AddItem(g *CartGrain, m *messages.AddItem) error {
}
pricePerItem := NewPriceFromIncVat(m.Price, taxRate)
g.Items = append(g.Items, &CartItem{
cartItem := &CartItem{
Id: g.lastItemId,
ItemId: uint32(m.ItemId),
Quantity: int(m.Quantity),
@@ -91,7 +94,12 @@ func AddItem(g *CartGrain, m *messages.AddItem) error {
ArticleType: m.ArticleType,
StoreId: m.StoreId,
})
}
if m.ReservationEndTime != nil {
t := m.ReservationEndTime.AsTime()
cartItem.ReservationEndTime = &t
}
g.Items = append(g.Items, cartItem)
g.UpdateTotals()
return nil
}