const deleteUserById = (data) => { if (data.role === 'user' || data.role === 'businessUser') { return false; } return User.findByIdAndRemove(data.params.userId) .catch((err) => { log.error('ERR: ', err); return false; }) .then(() => true); }
async destroy(req, res) { const tracking = await Tracking.findByIdAndRemove(req.params.id) .then(() => { res.status(200).json({ status: 200, message: 'Data successfully deleted', type: 'Success' }); console.log("Data successfully deleted".green); }).catch((err) => { res.status(500).json({ status: 500, message: 'Error deleting data', type: 'Failure' }); console.log(err.message.red); }); }
// 删除评论的回复 const delectReply = async (_id) => { return await Reply.findByIdAndRemove(_id) }
async destroy(req, res){ await Product.findByIdAndRemove(req.params.id); return res.send(); }
const deleteBusinessUserById = (data) => { if (data.role === 'user' || data.role === 'businessUser') { return false; } return BusinessUser.findByIdAndRemove(data.params.businessUserId) .then(() => { Business.findOneAndRemove({ ownerId: data.params.businessUserId }); return true; }) .catch((err) => { log.error('ERR: ', err); return false; }); }
const deleteAdmin = (data) => { if (data.authUser.role === 'super-admin') { return User.findByIdAndRemove(data.body.id) .catch((err) => { log.error('ERR: ', err); return false; }) .then(() => true); } return false; }
const deleteReportById = (data) => { if (data.role === 'user' || data.role === 'businessUser') { return false; } return Reports.findByIdAndRemove(data.params.reportId) .then(deletedObject => deletedObject) .catch((err) => { log.error('ERR: ', err); return false; }); }
// 删除标签 const deleteTag = async (_id) => { return await Tag.findByIdAndRemove(_id) }
// 删除文章 const delectArticle = async (_id) => { return await Article.findByIdAndRemove(_id) }
async destroy(req, res) { await Product.findByIdAndRemove(req.params.id); return res.send(); }
async destroy(req, res){ await Product.findByIdAndRemove(req.params.id) return res.send(); }
async destroy(req, res) { const product = await Product.findByIdAndRemove(req.params.id) return res.send(); }
// 删除浏览墙 const delectHero = async (_id) => { return await Hero.findByIdAndRemove(_id) }
// 删除音乐 const delectMusic = async (_id) => { return await Music.findByIdAndRemove(_id) }
// 删除项目 const delectProject = async (_id) => { return await Project.findByIdAndRemove(_id) }