function deleteProject(id) { return Projects.destroy({ where: { id: id } }) }
const destroy = (req, res) => { const id = parseInt(req.params.id, 10); if (Number.isNaN(id)) return res.status(400).end(); models.User.destroy({ where: {id} }).then(() => { res.status(204).end(); }); }
models.User.destroy({ where: { id: id } }).then(count => { if (!count) { return res.status(404).send({error: 'No user'}); } res.status(204).send(); });
models.Attack.destroy({where: {id: attackId}}).then((count)=>{ models.Attack.sync().then(()=>{ resolve(count) }) }) .catch((err)=>{ console.log(err) reject(err) })
/** * 删除 */ router.get("/:id/del", function(req, res, next) { Role.destroy({ where: { id: req.params.id } }).then(function(result) { res.json({ status: 1, data: result }); }).catch(next); });
TxtOnly.findByPk(elementId).then(data => { if(!data) { return next(new Error('Data not found.')); } return TxtOnly.destroy({where:{id: elementId}}); }) .then(() => { console.log('DESTROYED DATA'); res.status(200).json({message: 'Success'}); }) .catch(err => { res.status(500).json({message: 'Deleting data failed.'}); })
pokemon.delete('/:id', async (req, res) => { const id = req.params.id; let nExcluidos = await Pokemon.destroy( { where: { id: id } } ); res.json( { nExcluidos: nExcluidos } ); });
static destroy(userId) { return db.User.destroy({ where: { id: userId } }) .then(rows => Promise.resolve(rows === 1)) }
/** * Remove a topic */ export function remove(req, res) { Topic.destroy({ where: { id: req.params.id } }).then(() => { res.status(200).send('Removed Successfully'); }).catch((err) => { console.log(err); res.status(500).send('We failed to delete for some reason'); }); }
ImgTxt.findByPk(elementId).then(data => { if(!data) { return next(new Error('Data not found.')); } fileHelper.deleteFile(data.imageUrl); return ImgTxt.destroy({where:{id: elementId}}); }) .then(() => { console.log('DESTROYED DATA'); res.status(200).json({message: 'Success'}); }) .catch(err => { res.status(500).json({message: 'Deleting data failed.'}); })
// end of the function cartCheckout function delFromCart(cartItemID) // definition of the function delFromCart { return CartProduct.destroy( { where: { id: cartItemID } }); }
ImgOnly.findByPk(elementId).then(data => { if(!data) { return next(new Error('Data not found.')); } fileHelper.deleteFile(data.imageUrl); return ImgOnly.destroy({where:{id: elementId}}); }) .then(() => { console.log('DESTROYED DATA'); res.status(200).json({message: 'Success'}); }) .catch(err => { res.status(500).json({message: 'Deleting data failed.'}); })
/** * 删除一个地址 */ router.get("/:id/del", function(req, res, next) { Address.destroy({ where: { id: req.params.id } }).then(function(result) { res.json({ status: 1, data: result }); }).catch(next); });
/** * 删除 */ router.get("/:id/del", function(req, res, next) { LoginInfo.destroy({ where: { id: req.params.id } }).then(function(result) { res.json({ status: 1, data: result }); }).catch(next); });
// end of the function totalamount function cartCheckout(data) { CartProduct.destroy({ where: {}}); }