mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-07-07 07:33:03 +02:00
feat(torrents): add torrent_vip method, route, policy of server side
This commit is contained in:
@@ -519,6 +519,27 @@ exports.toggleHnRStatus = function (req, res) {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* toggleVIPStatus
|
||||
* @param req
|
||||
* @param res
|
||||
*/
|
||||
exports.toggleVIPStatus = function (req, res) {
|
||||
var torrent = req.torrent;
|
||||
|
||||
torrent.torrent_vip = !torrent.torrent_vip;
|
||||
|
||||
torrent.save(function (err) {
|
||||
if (err) {
|
||||
return res.status(422).send({
|
||||
message: errorHandler.getErrorMessage(err)
|
||||
});
|
||||
} else {
|
||||
res.json(torrent);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* removeTorrentHnRWarning
|
||||
* @param torrent
|
||||
|
||||
@@ -27,6 +27,7 @@ exports.invokeRolesPolicies = function () {
|
||||
{resources: '/api/torrents/:torrentId/thumbsUp', permissions: '*'},
|
||||
{resources: '/api/torrents/:torrentId/scrape', permissions: '*'},
|
||||
{resources: '/api/torrents/:torrentId/toggleHnRStatus', permissions: '*'},
|
||||
{resources: '/api/torrents/:torrentId/toggleVIPStatus', permissions: '*'},
|
||||
{resources: '/api/torrents/:torrentId/set/saletype/:saleType', permissions: '*'},
|
||||
{resources: '/api/torrents/:torrentId/set/recommendlevel/:rlevel', permissions: '*'},
|
||||
{resources: '/api/torrents/:torrentId/set/reviewed', permissions: '*'},
|
||||
|
||||
@@ -44,6 +44,9 @@ module.exports = function (app) {
|
||||
app.route('/api/torrents/:torrentId/toggleHnRStatus').all(torrentsPolicy.isAllowed)
|
||||
.put(torrents.toggleHnRStatus);
|
||||
|
||||
app.route('/api/torrents/:torrentId/toggleVIPStatus').all(torrentsPolicy.isAllowed)
|
||||
.put(torrents.toggleVIPStatus);
|
||||
|
||||
app.route('/api/torrents/:torrentId/set/saletype/:saleType').all(torrentsPolicy.isAllowed)
|
||||
.put(torrents.setSaleType);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user