Skip to content

Commit 6b13751

Browse files
committed
Bind Hacker.application.accommondaton.travel to Travel.request
1 parent 4e48321 commit 6b13751

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

middlewares/hacker.middleware.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const Services = {
77
Storage: require("../services/storage.service"),
88
Email: require("../services/email.service"),
99
Account: require("../services/account.service"),
10+
Travel: require("../services/travel.service"),
1011
Env: require("../services/env.service")
1112
};
1213
const Middleware = {
@@ -511,6 +512,12 @@ async function updateHacker(req, res, next) {
511512
});
512513
}
513514
req.email = acct.email;
515+
516+
// If this hacker has a travel account associated with it, then update request to reflect amount wanted for travel
517+
const travel = await Services.Travel.findByHackerId(hacker.id);
518+
if (travel) {
519+
await Services.Travel.updateOne(travel.id, { "request": hacker.application.accommodation.travel });
520+
}
514521
return next();
515522
} else {
516523
return next({

0 commit comments

Comments
 (0)