feature/pubsub #7

Merged
mats merged 67 commits from feature/pubsub into main 2025-11-28 17:45:22 +01:00
3 changed files with 12 additions and 0 deletions
Showing only changes of commit ac8b870eb5 - Show all commits

View File

@@ -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"`

View File

@@ -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{}
}), }),

View 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
}