feat(ingredients): make units nullable

This commit is contained in:
efrilm
2026-08-11 21:20:17 +07:00
parent 9ae5be2c33
commit 0726fcecf0
11 changed files with 54 additions and 36 deletions
@@ -371,8 +371,8 @@ func (p *OrderIngredientTransactionProcessorImpl) CalculateWasteQuantities(ctx c
// Get unit name
unitName := "unit" // default
if ingredient.UnitID != uuid.Nil {
unit, err := p.unitRepo.GetByID(ctx, ingredient.UnitID, organizationID)
if ingredient.UnitID != nil {
unit, err := p.unitRepo.GetByID(ctx, *ingredient.UnitID, organizationID)
if err == nil {
unitName = unit.Name
}