fa465ac29c
- 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.
26 lines
1.1 KiB
C#
26 lines
1.1 KiB
C#
namespace YesChef.Api.Entities;
|
|
|
|
/// <summary>
|
|
/// A family's override of a global <see cref="Product"/>. Each non-null field
|
|
/// replaces the global value when the family views the catalog. Composite key
|
|
/// (<see cref="FamilyId"/>, <see cref="ProductId"/>) — at most one override
|
|
/// per family per product.
|
|
/// </summary>
|
|
public class FamilyProductOverride
|
|
{
|
|
public int FamilyId { get; set; }
|
|
public Family Family { get; set; } = null!;
|
|
public int ProductId { get; set; }
|
|
public Product Product { get; set; } = null!;
|
|
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; }
|
|
// Null = inherit Product.DefaultSection. Non-null = family override of
|
|
// the recommended section name.
|
|
public string? DefaultSection { get; set; }
|
|
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
|
}
|