From c1310f5d2fce5fd9df42c8cc8753ea5895aab377 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 21 Aug 2025 11:38:42 -0700 Subject: fix invoice update --- routes/invoices.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'routes') diff --git a/routes/invoices.ts b/routes/invoices.ts index 37b79e8a..a2bab026 100644 --- a/routes/invoices.ts +++ b/routes/invoices.ts @@ -55,9 +55,10 @@ export default { const { body } = req; if (!body.invoice?.tip || body.invoice.tip < 0) fail("Invalid tip"); - const invoice = await g(`invoice:${id}`); + let invoice = await g(`invoice:${id}`); + const user = await g(`user:${invoice.uid}`); invoice.tip = body.invoice.tip; - invoice.amount += invoice.tip; + invoice = await generate({ invoice, user }); await s(`invoice:${id}`, invoice); res.send(invoice); -- cgit v1.2.3