@RequestMapping(value = "/events", method = GET) public List<EventWithStatistics> getAllEvents(Principal principal) { return eventStatisticsManager .getAllEventsWithStatistics(principal.getName()) .stream() .sorted() .collect(Collectors.toList()); }
@RequestMapping(value = "/events/{eventName}/pending-payments") public List<SerializablePair<TicketReservation, OrderSummary>> getPendingPayments( @PathVariable("eventName") String eventName, Principal principal) { return ticketReservationManager .getPendingPayments( eventStatisticsManager.getSingleEventWithStatistics(eventName, principal.getName())) .stream() .map(SerializablePair::fromPair) .collect(Collectors.toList()); }
@RequestMapping(value = "/events/{name}", method = GET) public Map<String, Object> getSingleEvent( @PathVariable("name") String eventName, Principal principal) { Map<String, Object> out = new HashMap<>(); final String username = principal.getName(); final EventWithStatistics event = eventStatisticsManager.getSingleEventWithStatistics(eventName, username); out.put("event", event); out.put("organization", eventManager.loadOrganizer(event.getEvent(), username)); return out; }
@RequestMapping(value = "/events/{eventName}/categories-containing-tickets", method = GET) public List<TicketCategoryModification> getCategoriesWithTickets( @PathVariable("eventName") String eventName, Principal principal) { Event event = loadEvent(eventName, principal); return eventStatisticsManager .loadTicketCategoriesWithStats(event) .stream() .filter(tc -> !tc.getTickets().isEmpty()) .map( tc -> TicketCategoryModification.fromTicketCategory( tc.getTicketCategory(), ticketCategoryDescriptionRepository.findByTicketCategoryId(tc.getId()), event.getZoneId())) .collect(Collectors.toList()); }