This commit is contained in:
Piotr Biernat 2023-03-20 17:44:53 +01:00
parent 79e60fc242
commit de5b8ddad7

View File

@ -2,7 +2,6 @@ package ui
import ( import (
"context" "context"
"fmt"
"strconv" "strconv"
"time" "time"
@ -22,17 +21,16 @@ func GetProductPrice(srv *service.PriceService, prodID int) (*def.ProductPriceRe
if err != nil { if err != nil {
return res, err return res, err
} }
res.Price = price res.Price = price
// CalculateProductPrice(srv, prodID, res.Price)
fmt.Printf("SAving to cache: %s", key)
srv.SaveToCache(ctx, key, res.Price, 30*time.Second) // FIXME refactor as cache service sth srv.SaveToCache(ctx, key, res.Price, 30*time.Second) // FIXME refactor as cache service sth
} }
return res, nil return res, nil
} }
// CalculateProductPrice mock
func CalculateProductPrice(srv *service.PriceService, prodID int, price float64) (float64, error) { func CalculateProductPrice(srv *service.PriceService, prodID int, price float64) (float64, error) {
// customer := srv.GetCustomer(customerID) // customer := srv.GetCustomer(customerID)
// customerPromo := srv.GetCustomerPromotions(customer) // customerPromo := srv.GetCustomerPromotions(customer)
// customerDiscount := srv.GetCustomerDiscounts(customer) // customerDiscount := srv.GetCustomerDiscounts(customer)