API Basket update

This commit is contained in:
Piotr Biernat 2024-12-24 17:59:01 +01:00
parent 8394feaec7
commit f130eaedd7

View File

@ -3,7 +3,8 @@ package api
import (
"fmt"
def "git.pbiernat.io/egommerce/api-entities/http"
"git.ego.cloudns.be/egommerce/api-entities/basket"
basket "git.ego.cloudns.be/egommerce/api-entities/basket/dto"
"github.com/go-redis/redis/v8"
)
@ -15,9 +16,9 @@ type BasketAPI struct {
httpClient *HttpClient
}
func (a *BasketAPI) GetBasket(basketID string) (*def.GetBasketResponse, error) {
req := &def.GetBasketRequest{BasketID: basketID}
res := new(def.GetBasketResponse)
func (a *BasketAPI) GetBasket(basketID string) (*basket.GetBasketResponseDTO, error) {
req := &basket.GetBasketRequestDTO{BasketID: basketID}
res := new(basket.GetBasketResponse)
if err := a.httpClient.SendGet("basket-svc", "/api/v1/basket", req, res); err != nil {
return nil, err
}
@ -25,9 +26,9 @@ func (a *BasketAPI) GetBasket(basketID string) (*def.GetBasketResponse, error) {
return res, nil
}
func (a *BasketAPI) GetBasketItems(basketID string) ([]*def.GetBasketItemsResponse, error) {
func (a *BasketAPI) GetBasketItems(basketID string) ([]*basket.GetBasketItemsResponseDTO, error) {
url := fmt.Sprintf("/api/v1/basket/%s/items", basketID)
var res []*def.GetBasketItemsResponse
var res []*basket.GetBasketItemsResponseDTO
if err := a.httpClient.SendGet("basket-svc", url, nil, &res); err != nil {
return nil, err
}