diff --git a/src/routes/api/v1/categories.ts b/src/routes/api/v1/categories.ts index 2fb187a..c16131a 100644 --- a/src/routes/api/v1/categories.ts +++ b/src/routes/api/v1/categories.ts @@ -42,10 +42,13 @@ function post(req: Request, res: Response) { data: { name: req.body.name, description: req.body.description + }, + select: { + id: true } }) - .then(() => { - res.status(201).json({ status: 'created' }); + .then((data) => { + res.status(201).json({ status: 'created', id: data.id }); }) .catch((err) => { // Check if an entry already exists.