Inventory: raw materials, batches, expiry, harvest-to-table #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Tracks the inventory layer of #2 (
bistroandfulltiers).Background
DarthCoin's framing — even a simple bar wants inventory, not full
production. AIO's interest:
So inventory has two consumers from day one:
quesadillas tonight?"
30% margin, my burritos should be priced at Y." (Tracked under
#6.)
Probably its own extension someday
The user explicitly flagged this:
→ Build the inventory layer with extraction in mind. Concretely:
that could later become REST + Nostr endpoints on a separate
inventoryextension.direct DB joins from
menu_itemsto a hypotheticalinventory_*table).
item-id implicit FKs) so a future
inventoryextension can hostthe same rows for non-restaurant consumers.
If we keep this discipline now, hoisting becomes a refactor, not a
rewrite.
Data model (sketch)
Modifiers (e.g. extra cheese, brisket add-on) get their own
recipe_linesrows so adding them to an order decrements the rightinventory.
Behavior
qty_reserved += sum).Order paid → reservation is consumed (
qty_on_hand -= sum,qty_reserved -= sum).qty_on_hand += sum).every menu item whose recipe references it. The CMS shows why
("Tacos disabled — Brisket out of stock until restock").
material_batchrow with no purchase price(or marked as homegrown). Useful for the farm-to-table angle.
qty_on_handwhen crossed (configurable: hard-zero vs. soft-warn).
Stretch / farm-to-table
material_batchcan carry a Nostrevent id (NIP-94 file metadata or a custom kind) pointing at a
harvest record (photo, geohash, harvester pubkey).
optionally name the farm + harvest date for items that came from
a tracked batch. "Your tortilla: maíz from Finca Atitlán, 5 May
2026." Customer-facing flex.
extension, a single farm could supply multiple restaurants and
see combined demand.
Tiering (per #2)
menu item, no recipe expansion). Decrement = quantity ordered.
materials).
Acceptance
materials,material_batches,recipes,recipe_linestables.
list materials, see levels, log a batch / harvest, edit
recipes per menu item.
menu_items.is_availablesurfaced via the existing API.
well-defined functions in
services/inventory.pyso afuture extraction is a port, not a rewrite.
and the extraction-friendly seam.
See also
References