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

Commit

Permalink
Moved RSVP GET by attendeeId to new route
Browse files Browse the repository at this point in the history
  • Loading branch information
ASankaran committed Feb 23, 2018
1 parent 8899108 commit 003eaae
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions api/v1/controllers/RSVPController.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ function fetchRSVPByUser(req, res, next) {
}

function fetchRSVPById(req, res, next) {
services.RSVPService
.getRSVPById(req.params.id)
.then((rsvp) => {
res.body = rsvp.toJSON();

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

function fetchRSVPByUserId(req, res, next) {
services.RegistrationService
.findAttendeeById(req.params.id)
.then((attendee) => services.RSVPService
Expand Down Expand Up @@ -120,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

0 comments on commit 003eaae

Please sign in to comment.