User-supplied asset ids; brand on product; strain is the name
Build and push image / build (push) Successful in 48s

Four UX changes after using the rework for a bit:

1. Asset ids are 6-digit numbers from a roll of physical labels — server
   no longer generates them. POST /api/inventory requires assetId; the
   add-inventory form has a digits-only input that auto-focuses on entry.
2. Strain and product name are the same thing. Drop products.name; the
   strain's name supplies the display. Product creation just asks for
   "Name (strain)" and matches/creates a strain by that name.
3. Brand moves from inventory_items to products. SKUs are brand-specific,
   so all instances of a product share the brand. Brand selector lives
   on the product create/edit form, not the per-instance form.
4. Scanning an unknown SKU on the add-inventory step now opens the
   create-product subform with the SKU prefilled — one less click.

Migration: detect prior shape (products.name column present) and rename
products/inventory_items/audits to *_v1 archives, recreate empty.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-04 18:17:12 -04:00
parent 02dc6e523f
commit 80034b47c5
15 changed files with 380 additions and 256 deletions
+3 -5
View File
@@ -6,8 +6,8 @@ export const bootstrapRouter: Router = Router();
type ProductRow = {
id: string;
sku: string;
strain_id: string | null;
name: string;
strain_id: string;
brand_id: string | null;
type: string;
kind: string;
created_at: string;
@@ -17,7 +17,6 @@ type InventoryRow = {
id: string;
asset_id: string;
product_id: string;
brand_id: string | null;
shop_id: string | null;
bin_id: string | null;
price: number;
@@ -84,7 +83,7 @@ bootstrapRouter.get("/bootstrap", (_req, res) => {
id: p.id,
sku: p.sku,
strainId: p.strain_id,
name: p.name,
brandId: p.brand_id,
type: p.type,
kind: p.kind,
createdAt: p.created_at,
@@ -94,7 +93,6 @@ bootstrapRouter.get("/bootstrap", (_req, res) => {
id: i.id,
assetId: i.asset_id,
productId: i.product_id,
brandId: i.brand_id,
shopId: i.shop_id,
binId: i.bin_id,
price: i.price,