go routine and removing cart

This commit is contained in:
Daniel Goc
2026-04-13 09:21:33 +02:00
parent d4d55e2757
commit 1f6d5ecb72
4 changed files with 35 additions and 3 deletions

View File

@@ -34,6 +34,18 @@ func (s *CartsService) CreateNewCart(user_id uint) (model.CustomerCart, error) {
return cart, nil
}
func (s *CartsService) RemoveCart(user_id uint, cart_id uint) error {
exists, err := s.repo.UserHasCart(user_id, cart_id)
if err != nil {
return err
}
if !exists {
return responseErrors.ErrUserHasNoSuchCart
}
return s.repo.RemoveCart(user_id, cart_id)
}
func (s *CartsService) UpdateCartName(user_id uint, cart_id uint, new_name string) error {
exists, err := s.repo.UserHasCart(user_id, cart_id)
if err != nil {