Compare commits

..

No commits in common. "d3c0a66bd4485353578801c7107454e783d52455" and "5eef989e40badaf8072bea614ddbdd173ac0a00b" have entirely different histories.

2 changed files with 17 additions and 17 deletions

View File

@ -25,17 +25,17 @@ import (
) )
const ( const (
// defAppName = "basket-worker" defAppName = "basket-worker"
// defLoggerAddr = "api-logger:24224" defLoggerAddr = "api-logger:24224"
// defRegistryAddr = "api-registry:8500" defRegistryAddr = "api-registry:8500"
// defDbURL = "postgres://postgres:12345678@postgres-db:5432/egommerce" defDbURL = "postgres://postgres:12345678@postgres-db:5432/egommerce"
// defCacheAddr = "api-cache:6379" defCacheAddr = "api-cache:6379"
// defCachePassword = "12345678" defCachePassword = "12345678"
// defMongoDbURL = "mongodb://mongodb:12345678@mongo-db:27017" defMongoDbURL = "mongodb://mongodb:12345678@mongo-db:27017"
// defEventBusURL = "amqp://guest:guest@api-eventbus:5672" defEventBusURL = "amqp://guest:guest@api-eventbus:5672"
// ebEventsExchange = "api-events" ebEventsExchange = "api-events"
// ebEventsQueue = "basket-worker" ebEventsQueue = "basket-worker"
// defKVNmspc = "dev.egommerce/service/basket-worker" defKVNmspc = "dev.egommerce/service/basket-worker"
) )
func main() { func main() {
@ -169,7 +169,7 @@ func main() {
basket, err := ui.AddProductToBasket(basketSrv, productID, qty, basketID, reqID) basket, err := ui.AddProductToBasket(basketSrv, productID, qty, basketID, reqID)
if err == nil { if err == nil {
logger.Log("Product #%d added to basket #%s. ReqID: #%s", productID, basket.ID, reqID) logger.Log("Product #%s added to basket #%s. ReqID: #%s", productID, basket.ID, reqID)
} }
case strings.Contains(eName, event.EVENT_PRODUCT_REMOVED_FROM_BASKET): case strings.Contains(eName, event.EVENT_PRODUCT_REMOVED_FROM_BASKET):
productID := int(data["product_id"].(float64)) productID := int(data["product_id"].(float64))
@ -177,7 +177,7 @@ func main() {
basket, err := ui.RemoveProductFromBasket(basketSrv, productID, qty, basketID, reqID) basket, err := ui.RemoveProductFromBasket(basketSrv, productID, qty, basketID, reqID)
if err == nil { if err == nil {
logger.Log("Product #%d removed from basket #%s. ReqID: #%s", productID, basket.ID, reqID) logger.Log("Product #%s removed from basket #%s. ReqID: #%s", productID, basket.ID, reqID)
} }
} }

View File

@ -58,20 +58,20 @@ func (s *Server) GetRequestID(c *fiber.Ctx) (string, error) {
// @Refactor make single func with error message and optional http status code... // @Refactor make single func with error message and optional http status code...
func (s *Server) Error400(c *fiber.Ctx, msg string) error { func (s *Server) Error400(c *fiber.Ctx, msg string) error {
return c.Status(fiber.StatusBadRequest).JSON(http.ErrorResponse{Error: msg}) return c.Status(fiber.StatusBadRequest).JSON(http.ErrorResponse{msg})
// test with &(reference) before http.ErrorMessage, but probably it's gonna be erroneous // test with &(reference) before http.ErrorMessage, but probably it's gonna be erroneous
} }
func (s *Server) Error401(c *fiber.Ctx, msg string) error { func (s *Server) Error401(c *fiber.Ctx, msg string) error {
return c.Status(fiber.StatusUnauthorized).JSON(http.ErrorResponse{Error: msg}) return c.Status(fiber.StatusUnauthorized).JSON(http.ErrorResponse{msg})
} }
func (s *Server) Error403(c *fiber.Ctx, msg string) error { func (s *Server) Error403(c *fiber.Ctx, msg string) error {
return c.Status(fiber.StatusForbidden).JSON(http.ErrorResponse{Error: msg}) return c.Status(fiber.StatusForbidden).JSON(http.ErrorResponse{msg})
} }
func (s *Server) Error404(c *fiber.Ctx, msg string) error { func (s *Server) Error404(c *fiber.Ctx, msg string) error {
return c.Status(fiber.StatusNotFound).JSON(http.ErrorResponse{Error: msg}) return c.Status(fiber.StatusNotFound).JSON(http.ErrorResponse{msg})
} }
// @EndRefactor // @EndRefactor