mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
[#1675] fixes to populating Group.challenges, and display challenges in party
page. I'm not sure about having challenges as a subdoc anymore, i think it will be better performance and maintenance if we just reference Challenge.group/members and remove User.challenges & Group.challenges
This commit is contained in:
@@ -156,7 +156,7 @@ api.create = function(req, res){
|
||||
var challenge = new Challenge(req.body); // FIXME sanitize
|
||||
challenge.save(function(err, saved){
|
||||
if (err) return res.json(500, {err:err});
|
||||
Group.findByIdAndUpdate(saved.group, {$addToSet:{challenges:saved._id}}) // fixme error-check, and also better to do in middleware?
|
||||
Group.update({_id:saved.group}, {$addToSet:{challenges:saved._id}}) // fixme error-check, and also better to do in middleware?
|
||||
res.json(saved);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user