From 364785b689c1cec666f53835437c6b873c898590 Mon Sep 17 00:00:00 2001 From: nicgirault Date: Sat, 19 Aug 2023 16:06:14 +0200 Subject: [PATCH] fix: make sure update always return the id of the record --- src/update.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/update.ts b/src/update.ts index a89a2c2..9b2606f 100644 --- a/src/update.ts +++ b/src/update.ts @@ -19,7 +19,12 @@ export const update = ( return res.status(404).json({ error: 'Record not found' }) } - res.json(await doUpdate(req.params.id, req.body, { req, res })) + const result = await doUpdate(req.params.id, req.body, { req, res }) + + res.json({ + id: req.params.id, + ...result + }) } catch (error) { next(error) }