mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-03-03 18:51:09 +01:00
feat(admin): add warning torrents list of admin method
This commit is contained in:
@@ -155,3 +155,29 @@ exports.getUserDownloading = function (req, res) {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* list user warning torrents
|
||||
* @param req
|
||||
* @param res
|
||||
*/
|
||||
exports.getUserWarning = function (req, res) {
|
||||
Complete.find({
|
||||
user: req.model._id,
|
||||
hnr_warning: true
|
||||
}).populate({
|
||||
path: 'torrent',
|
||||
populate: {
|
||||
path: 'user',
|
||||
select: 'displayName profileImageURL'
|
||||
}
|
||||
}).exec(function (err, complets) {
|
||||
if (err) {
|
||||
return res.status(422).send({
|
||||
message: errorHandler.getErrorMessage(err)
|
||||
});
|
||||
} else {
|
||||
res.json(complets);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -43,6 +43,7 @@ exports.invokeRolesPolicies = function () {
|
||||
{resources: '/api/my/warning', permissions: '*'},
|
||||
{resources: '/api/:userId/seeding', permissions: '*'},
|
||||
{resources: '/api/:userId/downloading', permissions: '*'},
|
||||
{resources: '/api/:userId/warning', permissions: '*'},
|
||||
{resources: '/api/torrents/siteInfo', permissions: ['get']}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -24,4 +24,7 @@ module.exports = function (app) {
|
||||
app.route('/api/:userId/downloading').all(torrentsPolicy.isAllowed)
|
||||
.get(peers.getUserDownloading);
|
||||
|
||||
app.route('/api/:userId/warning').all(torrentsPolicy.isAllowed)
|
||||
.get(peers.getUserWarning);
|
||||
|
||||
};
|
||||
|
||||
@@ -186,6 +186,13 @@
|
||||
<dt class="h-line">{{ 'STATUS_FIELD.FINISHED' | translate}}:</dt>
|
||||
<dd class="h-line">{{ vm.user.finished }}</span></dd>
|
||||
|
||||
<div ng-if="vm.user.hnr_warning>0">
|
||||
<dt class="h-line">{{ 'STATUS_FIELD.HNY_WARNING' | translate}}:</dt>
|
||||
<dd class="h-line">
|
||||
<span class="badge badge_danger">{{vm.user.hnr_warning}}</span>
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
<li class="status-divider"></li>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user