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
@@ -80,6 +80,9 @@ namespace YesChef.Api.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("AllowedUnitCategories")
.HasColumnType("integer");
b.Property<string>("Brand")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
@@ -115,6 +118,9 @@ namespace YesChef.Api.Migrations
b.Property<int>("ProductId")
.HasColumnType("integer");
b.Property<int?>("AllowedUnitCategories")
.HasColumnType("integer");
b.Property<string>("Brand")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
@@ -273,6 +279,9 @@ namespace YesChef.Api.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("AllowedUnitCategories")
.HasColumnType("integer");
b.Property<string>("Brand")
.HasMaxLength(200)
.HasColumnType("character varying(200)");