use of alfio.controller.api.support.PageAndContent in project alf.io by alfio-event.
the class EmailMessageApiController method loadEmailMessages.
@RequestMapping("/")
public PageAndContent<List<LightweightEmailMessage>> loadEmailMessages(@PathVariable("eventName") String eventName, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "search", required = false) String search, Principal principal) {
Event event = eventManager.getSingleEvent(eventName, principal.getName());
ZoneId zoneId = event.getZoneId();
Pair<Integer, List<LightweightMailMessage>> found = notificationManager.loadAllMessagesForEvent(event.getId(), page, search);
return new PageAndContent<>(found.getRight().stream().map(m -> new LightweightEmailMessage(m, zoneId, true)).collect(Collectors.toList()), found.getLeft());
}
Aggregations