mirror of
https://github.com/hexolan/stocklet.git
synced 2026-03-26 11:41:18 +00:00
fix: misspell
docs: add reference to conventional commit messages corrections: * `AVALIABLE` -> `AVAILABLE` * `UNAVALIABLE` -> `UNAVAILABLE` * `succesful` -> `successful`
This commit is contained in:
@@ -154,7 +154,7 @@ func (svc OrderService) PlaceOrder(ctx context.Context, req *pb.PlaceOrderReques
|
||||
}
|
||||
|
||||
func (svc OrderService) ProcessProductPriceQuoteEvent(ctx context.Context, req *eventpb.ProductPriceQuoteEvent) (*emptypb.Empty, error) {
|
||||
if req.Type == eventpb.ProductPriceQuoteEvent_TYPE_AVALIABLE {
|
||||
if req.Type == eventpb.ProductPriceQuoteEvent_TYPE_AVAILABLE {
|
||||
// Set order status to processing (from pending)
|
||||
// Dispatch OrderProcessingEvent
|
||||
_, err := svc.store.ProcessOrder(ctx, req.OrderId, req.TotalPrice)
|
||||
@@ -162,7 +162,7 @@ func (svc OrderService) ProcessProductPriceQuoteEvent(ctx context.Context, req *
|
||||
return nil, errors.WrapServiceError(errors.ErrCodeExtService, "failed to update in response to event", err)
|
||||
}
|
||||
|
||||
} else if req.Type == eventpb.ProductPriceQuoteEvent_TYPE_UNAVALIABLE {
|
||||
} else if req.Type == eventpb.ProductPriceQuoteEvent_TYPE_UNAVAILABLE {
|
||||
// Set order status to rejected (from pending)
|
||||
// Dispatch OrderRejectedEvent
|
||||
_, err := svc.store.RejectOrder(ctx, req.OrderId)
|
||||
|
||||
@@ -17,6 +17,7 @@ package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"golang.org/x/exp/maps"
|
||||
|
||||
"github.com/doug-martin/goqu/v9"
|
||||
@@ -212,7 +213,7 @@ func (c postgresController) PriceOrderProducts(ctx context.Context, orderId stri
|
||||
productPrice, ok := productPrices[productId]
|
||||
if !ok {
|
||||
// Prepare and dispatch failure product pricing event
|
||||
evt, evtTopic, err := product.PrepareProductPriceQuoteEvent_Unavaliable(orderId)
|
||||
evt, evtTopic, err := product.PrepareProductPriceQuoteEvent_Unavailable(orderId)
|
||||
if err != nil {
|
||||
return errors.WrapServiceError(errors.ErrCodeService, "failed to create event", err)
|
||||
}
|
||||
@@ -229,8 +230,8 @@ func (c postgresController) PriceOrderProducts(ctx context.Context, orderId stri
|
||||
totalPrice += productPrice * float32(quantity)
|
||||
}
|
||||
|
||||
// Prepare and dispatch succesful product pricing event
|
||||
evt, evtTopic, err := product.PrepareProductPriceQuoteEvent_Avaliable(
|
||||
// Prepare and dispatch successful product pricing event
|
||||
evt, evtTopic, err := product.PrepareProductPriceQuoteEvent_Available(
|
||||
orderId,
|
||||
productQuantities,
|
||||
productPrices,
|
||||
|
||||
@@ -58,12 +58,12 @@ func PrepareProductDeletedEvent(product *pb.Product) ([]byte, string, error) {
|
||||
return messaging.MarshalEvent(event, topic)
|
||||
}
|
||||
|
||||
func PrepareProductPriceQuoteEvent_Avaliable(orderId string, productQuantities map[string]int32, productPrices map[string]float32, totalPrice float32) ([]byte, string, error) {
|
||||
func PrepareProductPriceQuoteEvent_Available(orderId string, productQuantities map[string]int32, productPrices map[string]float32, totalPrice float32) ([]byte, string, error) {
|
||||
topic := messaging.Product_PriceQuotation_Topic
|
||||
event := &eventspb.ProductPriceQuoteEvent{
|
||||
Revision: 1,
|
||||
|
||||
Type: eventspb.ProductPriceQuoteEvent_TYPE_AVALIABLE,
|
||||
Type: eventspb.ProductPriceQuoteEvent_TYPE_AVAILABLE,
|
||||
OrderId: orderId,
|
||||
ProductQuantities: productQuantities,
|
||||
ProductPrices: productPrices,
|
||||
@@ -73,12 +73,12 @@ func PrepareProductPriceQuoteEvent_Avaliable(orderId string, productQuantities m
|
||||
return messaging.MarshalEvent(event, topic)
|
||||
}
|
||||
|
||||
func PrepareProductPriceQuoteEvent_Unavaliable(orderId string) ([]byte, string, error) {
|
||||
func PrepareProductPriceQuoteEvent_Unavailable(orderId string) ([]byte, string, error) {
|
||||
topic := messaging.Product_PriceQuotation_Topic
|
||||
event := &eventspb.ProductPriceQuoteEvent{
|
||||
Revision: 1,
|
||||
|
||||
Type: eventspb.ProductPriceQuoteEvent_TYPE_UNAVALIABLE,
|
||||
Type: eventspb.ProductPriceQuoteEvent_TYPE_UNAVAILABLE,
|
||||
OrderId: orderId,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user