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
+4 -4
View File
@@ -18,11 +18,11 @@ export const api = {
// Catalog: products
createProduct: (body: {
sku: string;
name: string;
type: string;
kind: "bulk" | "discrete";
strainId?: string | null;
strainName?: string;
brandId?: string | null;
defaultThc?: number;
defaultCbd?: number;
defaultTotalCannabinoids?: number;
@@ -31,10 +31,11 @@ export const api = {
updateProduct: (
id: string,
body: Partial<{
name: string;
type: string;
kind: "bulk" | "discrete";
strainId: string | null;
strainName: string;
brandId: string | null;
}>,
) =>
request<{ ok: true }>(`/products/${id}`, {
@@ -62,8 +63,8 @@ export const api = {
// Inventory items (instances)
createInventoryItem: (body: {
assetId: string;
productId: string;
brandId?: string | null;
shopId?: string | null;
binId?: string | null;
price: number;
@@ -83,7 +84,6 @@ export const api = {
updateInventoryItem: (
id: string,
body: Partial<{
brandId: string | null;
shopId: string | null;
binId: string | null;
price: number;