fix: include quantity in getAllItems select, createItem values, and updateItem type
All checks were successful
CI / ci (push) Successful in 24s
CI / ci (pull_request) Successful in 25s
CI / e2e (push) Successful in 1m3s
CI / e2e (pull_request) Successful in 1m1s

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:
2026-04-03 19:57:25 +02:00
parent 70e7cd2f0f
commit fb925a9dce

View File

@@ -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;