add reservations to the model
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user