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:
Josh Rogers
2026-05-13 22:17:43 -05:00
parent fb1bc2b7e1
commit fd6b0accc8
14 changed files with 1411 additions and 36 deletions
@@ -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;
}