mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-07-19 11:02:43 +02:00
torrent list&read model populate('subtitles')
This commit is contained in:
@@ -399,6 +399,7 @@ exports.list = function (req, res) {
|
||||
Torrent.find(condition)
|
||||
.sort('-createdat')
|
||||
.populate('user', 'displayName')
|
||||
.populate('subtitles')
|
||||
.skip(skip)
|
||||
.limit(limit)
|
||||
.exec(function (err, torrents) {
|
||||
@@ -423,16 +424,19 @@ exports.torrentByID = function (req, res, next, id) {
|
||||
});
|
||||
}
|
||||
|
||||
Torrent.findById(id).populate('user', 'displayName').exec(function (err, torrent) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
} else if (!torrent) {
|
||||
return res.status(404).send({
|
||||
message: 'No torrent with that id has been found'
|
||||
});
|
||||
}
|
||||
req.torrent = torrent;
|
||||
next();
|
||||
});
|
||||
Torrent.findById(id)
|
||||
.populate('user', 'displayName')
|
||||
.populate('subtitles')
|
||||
.exec(function (err, torrent) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
} else if (!torrent) {
|
||||
return res.status(404).send({
|
||||
message: 'No torrent with that id has been found'
|
||||
});
|
||||
}
|
||||
req.torrent = torrent;
|
||||
next();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user