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:
@@ -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)");
|
||||
|
||||
Reference in New Issue
Block a user