feature/pubsub #7
@@ -81,6 +81,7 @@ type CartGrain struct {
|
|||||||
lastAccess time.Time
|
lastAccess time.Time
|
||||||
lastChange time.Time // unix seconds of last successful mutation (replay sets from event ts)
|
lastChange time.Time // unix seconds of last successful mutation (replay sets from event ts)
|
||||||
userId string
|
userId string
|
||||||
|
InventoryReserved bool `json:"inventoryReserved"`
|
||||||
Id CartId `json:"id"`
|
Id CartId `json:"id"`
|
||||||
Items []*CartItem `json:"items"`
|
Items []*CartItem `json:"items"`
|
||||||
TotalPrice *Price `json:"totalPrice"`
|
TotalPrice *Price `json:"totalPrice"`
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ func NewCartMultationRegistry() actor.MutationRegistry {
|
|||||||
actor.NewMutation(UpsertSubscriptionDetails, func() *messages.UpsertSubscriptionDetails {
|
actor.NewMutation(UpsertSubscriptionDetails, func() *messages.UpsertSubscriptionDetails {
|
||||||
return &messages.UpsertSubscriptionDetails{}
|
return &messages.UpsertSubscriptionDetails{}
|
||||||
}),
|
}),
|
||||||
|
actor.NewMutation(InventoryReserved, func() *messages.InventoryReserved {
|
||||||
|
return &messages.InventoryReserved{}
|
||||||
|
}),
|
||||||
actor.NewMutation(PreConditionFailed, func() *messages.PreConditionFailed {
|
actor.NewMutation(PreConditionFailed, func() *messages.PreConditionFailed {
|
||||||
return &messages.PreConditionFailed{}
|
return &messages.PreConditionFailed{}
|
||||||
}),
|
}),
|
||||||
|
|||||||
8
pkg/cart/mutation_inventory_reserved.go
Normal file
8
pkg/cart/mutation_inventory_reserved.go
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
package cart
|
||||||
|
|
||||||
|
import "git.tornberg.me/go-cart-actor/pkg/messages"
|
||||||
|
|
||||||
|
func InventoryReserved(g *CartGrain, m *messages.InventoryReserved) error {
|
||||||
|
g.InventoryReserved = true
|
||||||
|
return nil
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user