Skip to content
This repository has been archived by the owner on Jun 21, 2019. It is now read-only.

Commit

Permalink
Merge pull request #242 from HackIllinois/rsvp-get-fix
Browse files Browse the repository at this point in the history
Fix RSVP Get
  • Loading branch information
YashoSharma authored Feb 23, 2018
2 parents 25fa0dc + 003eaae commit 5968053
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
14 changes: 14 additions & 0 deletions api/v1/controllers/RSVPController.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@ function fetchRSVPById(req, res, next) {
.catch((error) => next(error));
}

function fetchRSVPByUserId(req, res, next) {
services.RegistrationService
.findAttendeeById(req.params.id)
.then((attendee) => services.RSVPService
.findRSVPByAttendee(attendee))
.then((rsvp) => {
res.body = rsvp.toJSON();

return next();
})
.catch((error) => next(error));
}

function updateRSVPByUser(req, res, next) {

let attendeeModel;
Expand Down Expand Up @@ -118,6 +131,7 @@ router.post('/attendee', middleware.request(requests.RSVPRequest),
middleware.permission(roles.ATTENDEE, _isValidUser), createRSVP);
router.get('/attendee/', middleware.permission(roles.ATTENDEE, _isValidUser), fetchRSVPByUser);
router.get('/attendee/:id(\\d+)', middleware.permission(roles.ORGANIZERS), fetchRSVPById);
router.get('/attendee/user/:id(\\d+)', middleware.permission(roles.ORGANIZERS), fetchRSVPByUserId);
router.put('/attendee/', middleware.request(requests.RSVPRequest),
middleware.permission(roles.ATTENDEE, _isValidUser), updateRSVPByUser);

Expand Down
6 changes: 2 additions & 4 deletions api/v1/controllers/RecruiterInterestController.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ const router = require('express').Router();
function createInterest(req, res, next) {
services.RegistrationService
.findAttendeeById(req.body.attendeeUserId, false)
.then((attendee) => {
return services.RecruiterInterestService
.then((attendee) => services.RecruiterInterestService
.createInterest(req.user.get('id'), attendee.get('id'), req.body.comments, req.body.favorite)
.then((result) => {
res.body = result.toJSON();
return next();
});
})
}))
.catch((error) => next(error));
}

Expand Down

0 comments on commit 5968053

Please sign in to comment.