User-supplied asset ids; brand on product; strain is the name
Build and push image / build (push) Successful in 48s
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:
@@ -35,12 +35,12 @@ catalogRouter.patch("/brands/:id", (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
// Deleting a brand unparents any inventory items that reference it
|
||||
// (brand_id → NULL), so users never lose inventory when reorganizing.
|
||||
// Deleting a brand unparents any products that reference it
|
||||
// (brand_id → NULL on products), so users never lose inventory.
|
||||
catalogRouter.delete("/brands/:id", (req, res) => {
|
||||
const { id } = req.params;
|
||||
const tx = db.transaction(() => {
|
||||
db.prepare("UPDATE inventory_items SET brand_id = NULL WHERE brand_id = ?").run(id);
|
||||
db.prepare("UPDATE products SET brand_id = NULL WHERE brand_id = ?").run(id);
|
||||
const result = db.prepare("DELETE FROM brands WHERE id = ?").run(id);
|
||||
if (result.changes === 0) throw new Error("not found");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user