Add created id to response of category api
This commit is contained in:
parent
64c14db183
commit
533bc1744d
@ -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.
|
||||||
|
Loading…
Reference in New Issue
Block a user