Fas 2 steg 5: Scan-to-scan-diff + konfliktlösning, samt buggfix depleted-transaktion i reconciliation
This commit is contained in:
@@ -228,7 +228,17 @@ export async function reconciliationRoutes(app: FastifyInstance) {
|
||||
.returning();
|
||||
if (!updated) throw errors.internal("Kunde inte uppdatera varan.");
|
||||
|
||||
if (input.action === "exists" || quantityChange !== 0) {
|
||||
if (input.action === "depleted") {
|
||||
await app.db.insert(schema.inventoryTransactions).values({
|
||||
inventoryItemId: params.itemId,
|
||||
householdId,
|
||||
actorUserId: req.userId,
|
||||
type: "correction",
|
||||
quantityDelta: -item.quantity,
|
||||
unit: item.unit,
|
||||
note: input.note,
|
||||
});
|
||||
} else if (input.action === "exists" || quantityChange !== 0) {
|
||||
await app.db.insert(schema.inventoryTransactions).values({
|
||||
inventoryItemId: params.itemId,
|
||||
householdId,
|
||||
|
||||
Reference in New Issue
Block a user