0
我正在做一个删除记录的请求,但之后要立即查询剩余的记录。如何在DELETE成功后查询剩余的记录。可能销毁记录并返回剩余记录?
到目前为止,我有这个,我做了DELETE请求,然后查询基于身份码(1成功,0失败),但不知道是否有更好的方式来处理这个问题:
app.delete('/projects', (req, res) => {
const { id } = req.query;
Item
.destroy({ where: { id: id } })
.then(status => {
if (status === 1) {
// make query here, something like:
// Item.findAll().then(...)
}
})
.catch(err => err);
});