Add created id to response of category api

This commit is contained in:
Leon Meier 2023-05-16 18:01:10 +02:00
parent 64c14db183
commit 533bc1744d

View File

@ -42,10 +42,13 @@ function post(req: Request, res: Response) {
data: { data: {
name: req.body.name, name: req.body.name,
description: req.body.description description: req.body.description
},
select: {
id: true
} }
}) })
.then(() => { .then((data) => {
res.status(201).json({ status: 'created' }); res.status(201).json({ status: 'created', id: data.id });
}) })
.catch((err) => { .catch((err) => {
// Check if an entry already exists. // Check if an entry already exists.