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:
parent
5623f64732
commit
618992206e
1 changed files with 1 additions and 1 deletions
|
|
@ -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]
|
[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) => {
|
app.delete('/api/attachments/:id', { preHandler: [requireAuth, requireCap('count')] }, async (req, reply) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue