예제 #1
0
 /** Write the list of event favorites to the body of the response. */
 @RequestMapping(
     value = "/events/{eventId}/favorites",
     method = RequestMethod.GET,
     produces = "application/json")
 public @ResponseBody List<EventSession> favorites(@PathVariable Long eventId, Account account) {
   return eventRepository.findEventFavorites(eventId, account.getId());
 }
예제 #2
0
 /**
  * Toggle a session as an attendee favorite. Write the new favorite status to the body of the
  * response.
  */
 @RequestMapping(
     value = "/events/{eventId}/sessions/{sessionId}/favorite",
     method = RequestMethod.PUT)
 public @ResponseBody Boolean toggleFavorite(
     @PathVariable Long eventId, @PathVariable Integer sessionId, Account account) {
   return eventRepository.toggleFavorite(eventId, sessionId, account.getId());
 }
예제 #3
0
 /**
  * Revoke the account access that was previously granted to a client application. After executing
  * this operation, the client application will no longer be able to access or update the member's
  * data. Used when the member no longer wishes to use the client application, or if the client
  * application was compromised in some way (for example, if the user's mobile phone where the app
  * was installed was stolen).
  *
  * @param accessToken the access token identifying the connection between a client application and
  *     a member account
  * @param account the member requesting the termination of the access grant
  * @return A redirect back to settings page.
  */
 @RequestMapping(value = "/settings/apps/{accessToken}", method = RequestMethod.DELETE)
 public String disconnectApp(@PathVariable String accessToken, Account account) {
   jdbcTemplate.update(
       "delete from AppConnection where accessToken = ? and member = ?",
       accessToken,
       account.getId());
   return "redirect:/settings";
 }
예제 #4
0
 /**
  * Render the setting page to the member as HTML in their web browser. Puts the list of
  * applications the member has connected their account with in the model (to support Disconnecting
  * those apps if desired).
  */
 @RequestMapping(value = "/settings", method = RequestMethod.GET)
 public void settingsPage(Account account, Model model) {
   List<Map<String, Object>> apps =
       jdbcTemplate.queryForList(
           "select a.name as name, c.accessToken from AppConnection c, App a where c.member = ? and c.app = a.id",
           account.getId());
   model.addAttribute("apps", apps);
 }
예제 #5
0
 /** Write the sessions scheduled for the day to the body of the response. */
 @RequestMapping(
     value = "/events/{eventId}/sessions/{day}",
     method = RequestMethod.GET,
     produces = "application/json")
 public @ResponseBody List<EventSession> sessionsOnDay(
     @PathVariable Long eventId,
     @PathVariable @DateTimeFormat(iso = ISO.DATE) LocalDate day,
     Account account) {
   return eventRepository.findSessionsOnDay(eventId, day, account.getId());
 }
예제 #6
0
 /**
  * Add or update the rating given to the session by the attendee. Write the new average rating for
  * the session to the body of the response.
  */
 @RequestMapping(
     value = "/events/{eventId}/sessions/{sessionId}/rating",
     method = RequestMethod.POST)
 public @ResponseBody Float updateRating(
     @PathVariable Long eventId,
     @PathVariable Integer sessionId,
     Account account,
     @RequestParam Short value,
     @RequestParam String comment)
     throws RatingPeriodClosedException {
   return eventRepository.rate(eventId, sessionId, account.getId(), new Rating(value, comment));
 }