Repository navigation
Closed
Labels
area:apiAPI/endpoint layerAPI/endpoint layerarea:domainDomain layerDomain layerarea:frontendReact/Vite web clientReact/Vite web clientenhancementNew feature or requestNew feature or requestepic-1.1sliceThin vertical work itemThin vertical work item
Description
Spec §10.1–10.2 + §9.7. Phase 1.1 item "Product catalog with egg products (replace raw grade strings)", split in two sequential PRs to keep review and rollback sane:
- Part 1 (this issue): the catalog itself — products, egg-grade mappings, packed-unit conversions. No sales changes.
- Part 2 (filed after part 1 merges): sales order items switch from raw
eggGradeIdtoproductId+ unit + snapshottedbase_unit_factor/quantity_base, with data migration of existing lines.
Scope (part 1)
Domain:
Product: name, productType (egg only usable now; enum carries the future values from §10.1), defaultUnit, defaultPriceMinorUnits?, currency snapshot, active, notes, Version. Aggregate with Version concurrency per AGENTS.md.ProductEggGradeMapping: product → egg grade. Phase 1: exactly one mapping per egg product (multi-grade products like mixed cartons come later); unique per product.EggUnitConversion: unitCode (individual/dozen/flat/tray/carton/case/other), eggsPerUnit, active. Account-level for the MVP (farm override column reserved per spec but single-farm today). Seed defaults on account creation: individual=1, dozen=12, flat/tray=30, carton=12, case=360 — farm-editable because carton/case sizes are market-specific (§9.7: no implicit fixed factors).
API (/api/v1/products, /api/v1/egg-unit-conversions):
- Products: create/update/deactivate + list. Writes AdminOnly (catalog is configuration, F19 principle); reads open (workers see product names when selling later).
- Conversions: list open; update AdminOnly. eggsPerUnit ≥ 1. No delete — deactivate only;
individualis not editable (always 1). - Audit events on catalog writes (Product.Create/Update/Deactivate, EggUnitConversion.Update) per §18.
- Egg products must reference an existing, active egg grade; mapping travels with product create/update.
SPA: admin Products page (list + create + edit + deactivate, mapping picker sourced from grades, conversions editor). GLOSSARY + Help sync.
Tests
- CRUD + validation (duplicate name per account, mapping to missing/inactive grade, eggsPerUnit < 1)
- Version concurrency parallel race (delta exactly 1)
- Worker 403 on writes, 200 on reads
- Tenant isolation
- Seeded conversion defaults present for a new account
- Audit events written with the writes
Metadata
Metadata
Assignees
Labels
area:apiAPI/endpoint layerAPI/endpoint layerarea:domainDomain layerDomain layerarea:frontendReact/Vite web clientReact/Vite web clientenhancementNew feature or requestNew feature or requestepic-1.1sliceThin vertical work itemThin vertical work item
Activity
F25 (part 1): Product catalog — egg products, grade mappings, packed-…