Co-authored-by: matst80 <mats.tornberg@gmail.com> Reviewed-on: #8 Co-authored-by: Mats Törnberg <mats@tornberg.me> Co-committed-by: Mats Törnberg <mats@tornberg.me>
19 lines
346 B
Go
19 lines
346 B
Go
package cart
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
messages "git.k6n.net/go-cart-actor/proto/cart"
|
|
)
|
|
|
|
func RemoveLineItemMarking(grain *CartGrain, req *messages.RemoveLineItemMarking) error {
|
|
|
|
for i, item := range grain.Items {
|
|
if item.Id == req.Id {
|
|
grain.Items[i].Marking = nil
|
|
return nil
|
|
}
|
|
}
|
|
return fmt.Errorf("item with ID %d not found", req.Id)
|
|
}
|