From 618992206e1c7ef51d8b17068a00b7c0f53326c0 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Thu, 2 Jul 2026 15:47:50 +0000 Subject: [PATCH] =?UTF-8?q?Fix=20upload=20response:=20ins.rows[0]=20?= =?UTF-8?q?=E2=86=92=20ins[0]=20(rows=20already=20destructured)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit INSERT RETURNING * was succeeding but response threw TypeError trying to access .rows[0] on the already-unwrapped rows array. File was saved, DB record created, but 500 returned. Frontend now gets the record immediately without needing a refresh. Co-Authored-By: Claude Sonnet 4.6 --- backend/src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/index.js b/backend/src/index.js index 63c0b5f..6fba57a 100644 --- a/backend/src/index.js +++ b/backend/src/index.js @@ -86,7 +86,7 @@ app.post('/api/attachments/upload/:cash_up_id', { preHandler: [requireAuth, requ [cashUpId, fileData.filename, filePath, size, fileData.mimetype, req.user.email, attachmentType, label] ) - return ins.rows[0] + return ins[0] }) app.delete('/api/attachments/:id', { preHandler: [requireAuth, requireCap('count')] }, async (req, reply) => {