mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-06-09 15:07:49 +00:00
add validasi overselling telur
This commit is contained in:
@@ -964,7 +964,10 @@ func (s deliveryOrdersService) consumeDeliveryStock(ctx context.Context, tx *gor
|
||||
marketingProduct.ProductWarehouseId,
|
||||
resolveMarketingAsOf(deliveryProduct.DeliveryDate, deliveryProduct.CreatedAt),
|
||||
); err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, fmt.Sprintf("Insufficient stock for product warehouse %d: %v", marketingProduct.ProductWarehouseId, err))
|
||||
if errors.Is(err, fifoV2.ErrInsufficientStock) {
|
||||
return fiber.NewError(fiber.StatusBadRequest, "Stok tidak mencukupi untuk memenuhi permintaan delivery order ini")
|
||||
}
|
||||
return fiber.NewError(fiber.StatusBadRequest, fmt.Sprintf("Gagal mengalokasikan stok: %v", err))
|
||||
}
|
||||
|
||||
refreshed, err := deliveryProductRepo.GetByID(ctx, deliveryProduct.Id, nil)
|
||||
|
||||
Reference in New Issue
Block a user