mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
Fix /db/trial.request to handle when there is no req.user
This commit is contained in:
parent
98a5644226
commit
3ea562780d
1 changed files with 1 additions and 1 deletions
|
@ -43,7 +43,7 @@ module.exports =
|
|||
applicantID = req.query.applicant
|
||||
return next() unless applicantID
|
||||
throw new errors.UnprocessableEntity('Bad applicant id') unless utils.isID(applicantID)
|
||||
throw new errors.Forbidden('May not fetch for anyone but yourself') unless req.user.id is applicantID
|
||||
throw new errors.Forbidden('May not fetch for anyone but yourself') unless req.user?.id is applicantID
|
||||
trialRequests = yield TrialRequest.find({applicant: mongoose.Types.ObjectId(applicantID)})
|
||||
trialRequests = (tr.toObject({req: req}) for tr in trialRequests)
|
||||
res.status(200).send(trialRequests)
|
||||
|
|
Loading…
Reference in a new issue