mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 12:02:13 +00:00
Populate group and challenge leader on challenge GET request
This commit is contained in:
parent
da81241ebe
commit
eef3e293e2
1 changed files with 2 additions and 0 deletions
|
|
@ -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'});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue