diff --git a/dto/trashcart_dto.go b/dto/trashcart_dto.go index 4c9a0d6..e955600 100644 --- a/dto/trashcart_dto.go +++ b/dto/trashcart_dto.go @@ -24,6 +24,8 @@ type CartResponse struct { } type CartItemResponse struct { + ItemId string `json:"item_id"` + TrashId string `json:"trashid"` TrashIcon string `json:"trashicon"` TrashName string `json:"trashname"` Amount float32 `json:"amount"` diff --git a/internal/services/trashcart_redisservices.go b/internal/services/trashcart_redisservices.go index 1108fc0..a19b149 100644 --- a/internal/services/trashcart_redisservices.go +++ b/internal/services/trashcart_redisservices.go @@ -30,6 +30,7 @@ func GetCartItems(userID string) ([]dto.RequestCartItems, error) { if err != nil { return nil, err } + return items, nil } diff --git a/internal/services/trashcart_service.go b/internal/services/trashcart_service.go index 939ec40..04ebfd4 100644 --- a/internal/services/trashcart_service.go +++ b/internal/services/trashcart_service.go @@ -97,6 +97,7 @@ func (s *CartService) GetCartFromRedis(userID string) (*dto.CartResponse, error) estimatedTotal += subtotal cartItemDTOs = append(cartItemDTOs, dto.CartItemResponse{ + TrashId: trash.ID, TrashIcon: trash.Icon, TrashName: trash.Name, Amount: item.Amount, @@ -131,6 +132,8 @@ func (s *CartService) GetCart(userID string) (*dto.CartResponse, error) { var items []dto.CartItemResponse for _, item := range cartDB.CartItems { items = append(items, dto.CartItemResponse{ + ItemId: item.ID, + TrashId: item.TrashID, TrashIcon: item.TrashCategory.Icon, TrashName: item.TrashCategory.Name, Amount: item.Amount,