Files
YesChef/src/backend/YesChef.Api/Migrations/20260516025713_AddProductDefaultSection.cs
T
Josh Rogers fa465ac29c Section defaults on products with prompt-on-divergence
- Add DefaultSection (string?) to Product, FamilyProduct, and
  FamilyProductOverride. Resolution order on item add: per-store memory
  (ProductStoreSection) → family default (override or family product) →
  global product default, matched case-insensitively by name to the
  current store''s StoreSection rows.
- Drop the section dropdown from the add-item form; the backend resolves
  on POST. Section change on a list row syncs the family default:
  silently creates it when none exists, no-op when it matches, returns
  promptSaveDefault=true when it differs so the client confirms before
  updating.
- Expose DefaultSection on the catalog page form. Replace the native
  datalist with a styled TextCombobox component for autocomplete
  suggestions (seeded from typicalSections) while still allowing
  free-text entry. Pattern doc-noted as the sibling of ProductTypeahead.
- Remove the now-unused GET /api/products/{kind}/{id}/section endpoint
  and its tests; the add-form pre-fill they backed is gone.
2026-05-15 22:21:56 -05:00

52 lines
1.5 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace YesChef.Api.Migrations
{
/// <inheritdoc />
public partial class AddProductDefaultSection : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "DefaultSection",
table: "Products",
type: "character varying(100)",
maxLength: 100,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "DefaultSection",
table: "FamilyProducts",
type: "character varying(100)",
maxLength: 100,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "DefaultSection",
table: "FamilyProductOverrides",
type: "character varying(100)",
maxLength: 100,
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DefaultSection",
table: "Products");
migrationBuilder.DropColumn(
name: "DefaultSection",
table: "FamilyProducts");
migrationBuilder.DropColumn(
name: "DefaultSection",
table: "FamilyProductOverrides");
}
}
}