Fix upload response: ins.rows[0] → ins[0] (rows already destructured)

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 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-02 15:47:50 +00:00
parent 5623f64732
commit 618992206e

View file

@ -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) => {