From a03a2b461fa32371c6d6728dcaccafda933513ab Mon Sep 17 00:00:00 2001 From: Daniel Goc Date: Fri, 10 Apr 2026 13:25:00 +0200 Subject: [PATCH] small fix --- app/service/cartsService/cartsService.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/service/cartsService/cartsService.go b/app/service/cartsService/cartsService.go index c82e7b2..235c412 100644 --- a/app/service/cartsService/cartsService.go +++ b/app/service/cartsService/cartsService.go @@ -35,11 +35,11 @@ func (s *CartsService) CreateNewCart(user_id uint) (model.CustomerCart, error) { } func (s *CartsService) UpdateCartName(user_id uint, cart_id uint, new_name string) error { - amt, err := s.repo.UserHasCart(user_id, cart_id) + exists, err := s.repo.UserHasCart(user_id, cart_id) if err != nil { return err } - if amt != 1 { + if !exists { return responseErrors.ErrUserHasNoSuchCart } @@ -51,11 +51,11 @@ func (s *CartsService) RetrieveCartsInfo(user_id uint) ([]model.CustomerCart, er } func (s *CartsService) RetrieveCart(user_id uint, cart_id uint) (*model.CustomerCart, error) { - amt, err := s.repo.UserHasCart(user_id, cart_id) + exists, err := s.repo.UserHasCart(user_id, cart_id) if err != nil { return nil, err } - if amt != 1 { + if !exists { return nil, responseErrors.ErrUserHasNoSuchCart } @@ -63,19 +63,19 @@ func (s *CartsService) RetrieveCart(user_id uint, cart_id uint) (*model.Customer } func (s *CartsService) AddProduct(user_id uint, cart_id uint, product_id uint, product_attribute_id *uint, amount uint) error { - amt, err := s.repo.UserHasCart(user_id, cart_id) + exists, err := s.repo.UserHasCart(user_id, cart_id) if err != nil { return err } - if amt != 1 { + if !exists { return responseErrors.ErrUserHasNoSuchCart } - amt, err = s.repo.CheckProductExists(product_id, product_attribute_id) + exists, err = s.repo.CheckProductExists(product_id, product_attribute_id) if err != nil { return err } - if amt != 1 { + if !exists { return responseErrors.ErrProductOrItsVariationDoesNotExist }