Began integrating dashboard.
Also fixed match controller populate calls.
This commit is contained in:
@@ -48,12 +48,12 @@ MatchController.get("/recent/:limit?", needDatabase, async (req, res) => {
|
||||
}
|
||||
let recent = null;
|
||||
if (user) {
|
||||
await user.populate("participatingMatches");
|
||||
await user.populate("participatingMatches").populate("participatingMatches.members.$");
|
||||
recent = user.participatingMatches.slice(-limit);
|
||||
} else {
|
||||
recent = await matchModel.find().where("publicity").gte(2).limit(limit).sort({ createDate: -1 });
|
||||
recent = await matchModel.find().where("publicity").gte(2).limit(limit).sort({ createDate: -1 }).populate("members.$");
|
||||
}
|
||||
await recent.populate("members.$"); // Populates all references.
|
||||
await recent; // Populates all references.
|
||||
res.status(200).send({ recent: recent });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
Reference in New Issue
Block a user