Filter unit dropdown by product allowed-unit categories
Adds a UnitCategoryFlags column to Product, FamilyProduct, and FamilyProductOverride so each product can advertise which unit categories it is typically packaged by (e.g. flour: Weight | Volume). The product endpoints round-trip the flag, search projects the effective value with the override applied, and the frontend QuantityInput soft-filters its dropdown by the selected product's flag, with a "show all units" escape hatch for ad-hoc overrides. No backend rejection on a unit outside the allowed set — the flag is purely a hint. Default value is None (no filter), so existing data is unaffected. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,5 +15,8 @@ public class FamilyProductOverride
|
||||
public string? Name { get; set; }
|
||||
public string? Brand { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
// Nullable so "inherit global" (null) is distinguishable from
|
||||
// "explicitly None / any unit" (UnitCategoryFlags.None).
|
||||
public UnitCategoryFlags? AllowedUnitCategories { get; set; }
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user