diff --git a/src/libs/routes_v1/publication.js b/src/libs/routes_v1/publication.js index 2a4391042e7635b3bb13c9b3fd227aea16a6a3fc..46b0574d6d7c6c034e7f76ab0b4cd8f8724cda30 100644 --- a/src/libs/routes_v1/publication.js +++ b/src/libs/routes_v1/publication.js @@ -8,14 +8,10 @@ const config = require(`${libs}/config`); const log = require(`${libs}/log`)(module); -const VerificationToken = require(`${libs}/models/verificationToken`); - const Publication = require(`${libs}/models/publication`); const UserPublication = require(`${libs}/models/userPublication`); -const ResetToken = require(`${libs}/models/resetToken`); - const response = require(`${libs}/middlewares/response`); const email = require(`${libs}/middlewares/email`); @@ -166,4 +162,14 @@ pubApp.put('/:id', passport.authenticate('bearer', { session: false }), async (r }); +pubApp.delete('/:id', passport.authenticate('bearer', { session: false }), async (req, res, next) => { + await Publication.destroy({where:{id:req.params.id}}).catch(function (err) { + if (err) { + log.error(err); + return next({ err }); + } +}); + return next({ msg: 'Publication Deleted', status: 200 }); +}); + module.exports = pubApp; diff --git a/src/libs/routes_v1/resetToken.js b/src/libs/routes_v1/resetToken.js index 7c75841027edd99c80ddafd0dc6edba78910ae06..579bec0bde0c4bdff26e2f1dc588ff801697a82f 100644 --- a/src/libs/routes_v1/resetToken.js +++ b/src/libs/routes_v1/resetToken.js @@ -24,7 +24,7 @@ resetTokenApp.get('/:token', async (req, res, next) => { } if (rToken.hasExpired()) { res.statusCode = 410; - await ResetToken.remove({where:{ token: token}}).catch(function (err) { + await ResetToken.destroy({where:{ token: token}}).catch(function (err) { if (err) { log.error(err); return next({ err });