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: {
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.