Skip to content

Commit

Permalink
[fix]
Browse files Browse the repository at this point in the history
  • Loading branch information
goriiin committed Dec 22, 2024
1 parent ad243a7 commit f5d95e8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions internal/errs/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func (e *ErrorStore) Get(err error) (error, int) {
errCode, present := e.errorCodes[err]
if !present {
log.Println(fmt.Errorf("unexpected error occured: %w", err))

return InternalServerError, http.StatusInternalServerError
}

Expand Down
3 changes: 2 additions & 1 deletion internal/repository/orders/create_order_from_cart.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ func (r *OrdersRepo) CreateOrderFromCart(ctx context.Context, orderData *order.O

const insertProductQuery = `
INSERT INTO product_orders (id, order_id, product_id, option_id, count, delivery_date)
VALUES ($1, $2, $3, $4, $5, $6);
VALUES ($1, $2, $3, $4, $5, $6)
ON CONFLICT (count) DO NOTHING;
`

for _, p := range orderData.Products {
Expand Down
5 changes: 4 additions & 1 deletion internal/usecase/orders/create_order_from_cart.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ func (m *OrdersManager) CreateOrderFromCart(ctx context.Context, address string,

orderFromCart, err := m.repo.CreateOrderFromCart(ctx, orderData)
if err != nil {
m.logger.Error("failed to create orderFromCart in repo", slog.String("error", err.Error()), slog.Uint64("user_id", uint64(userID)), slog.Any("request-id", requestID))
m.logger.Error("failed to create orderFromCart in repo",
slog.String("error", err.Error()),
slog.Uint64("user_id", uint64(userID)),
slog.Any("request-id", requestID))
return nil, err
}

Expand Down

0 comments on commit f5d95e8

Please sign in to comment.