fix: include quantity in getAllItems select, createItem values, and updateItem type
Quantity was missing from three places in item.service.ts: - getAllItems didn't select it (API returned undefined) - createItem didn't pass it to insert (always used DB default of 1) - updateItem type didn't include it (silently stripped from updates) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ export function getAllItems(db: Db = prodDb) {
|
|||||||
name: items.name,
|
name: items.name,
|
||||||
weightGrams: items.weightGrams,
|
weightGrams: items.weightGrams,
|
||||||
priceCents: items.priceCents,
|
priceCents: items.priceCents,
|
||||||
|
quantity: items.quantity,
|
||||||
categoryId: items.categoryId,
|
categoryId: items.categoryId,
|
||||||
notes: items.notes,
|
notes: items.notes,
|
||||||
productUrl: items.productUrl,
|
productUrl: items.productUrl,
|
||||||
@@ -63,6 +64,7 @@ export function createItem(
|
|||||||
name: data.name,
|
name: data.name,
|
||||||
weightGrams: data.weightGrams ?? null,
|
weightGrams: data.weightGrams ?? null,
|
||||||
priceCents: data.priceCents ?? null,
|
priceCents: data.priceCents ?? null,
|
||||||
|
quantity: data.quantity ?? 1,
|
||||||
categoryId: data.categoryId,
|
categoryId: data.categoryId,
|
||||||
notes: data.notes ?? null,
|
notes: data.notes ?? null,
|
||||||
productUrl: data.productUrl ?? null,
|
productUrl: data.productUrl ?? null,
|
||||||
@@ -80,6 +82,7 @@ export function updateItem(
|
|||||||
name: string;
|
name: string;
|
||||||
weightGrams: number;
|
weightGrams: number;
|
||||||
priceCents: number;
|
priceCents: number;
|
||||||
|
quantity: number;
|
||||||
categoryId: number;
|
categoryId: number;
|
||||||
notes: string;
|
notes: string;
|
||||||
productUrl: string;
|
productUrl: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user