mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
Populate group and challenge leader on challenge GET request
This commit is contained in:
@@ -63,6 +63,8 @@ api.get = function(req, res, next) {
|
|||||||
// 3) Limit 30 (only show the 30 users currently in the lead)
|
// 3) Limit 30 (only show the 30 users currently in the lead)
|
||||||
Challenge.findById(req.params.cid)
|
Challenge.findById(req.params.cid)
|
||||||
.populate('members', 'profile.name _id')
|
.populate('members', 'profile.name _id')
|
||||||
|
.populate('group', '_id name')
|
||||||
|
.populate('leader', 'profile.name')
|
||||||
.exec(function(err, challenge){
|
.exec(function(err, challenge){
|
||||||
if(err) return next(err);
|
if(err) return next(err);
|
||||||
if (!challenge) return res.json(404, {err: 'Challenge ' + req.params.cid + ' not found'});
|
if (!challenge) return res.json(404, {err: 'Challenge ' + req.params.cid + ' not found'});
|
||||||
|
|||||||
Reference in New Issue
Block a user