22 lines
411 B
Go
22 lines
411 B
Go
package cart
|
|
|
|
import (
|
|
"time"
|
|
|
|
messages "git.tornberg.me/go-cart-actor/pkg/messages"
|
|
)
|
|
|
|
func ConfirmationViewed(grain *CartGrain, req *messages.ConfirmationViewed) error {
|
|
if grain.Confirmation == nil {
|
|
grain.Confirmation = &ConfirmationStatus{
|
|
ViewCount: 1,
|
|
LastViewedAt: time.Now(),
|
|
}
|
|
} else {
|
|
grain.Confirmation.ViewCount++
|
|
grain.Confirmation.LastViewedAt = time.Now()
|
|
}
|
|
|
|
return nil
|
|
}
|