class HomeController extends AbstractController {

    @RequestMapping("/")
    public ModelAndView home(@RequestParam(value = "ref", required = false) String ref, RedirectAttributes redirectAttributes, Principal principal) {
        final List<RequestView> requests = mappers.mapList(RequestDto.class, RequestView.class, requestService.findAll())
                .stream()
                .filter(request -> request.getPhase().toLowerCase().equals("open") && (hasFunds(request.getFunds().getFndFunds()) || hasFunds(request.getFunds().getOtherFunds())))
                .collect(toList());

        if (principal != null && StringUtils.isNotBlank(ref)) {
            eventPublisher.publishEvent(RefSignupEvent.builder().principal(principal).ref(ref).build());
            return redirectView(redirectAttributes).url("/").build();
        }
        return redirectView(redirectAttributes)
                .url("/requests")
                .build();
    }

    public  HomeController(ProfileService profileService,
                          ApplicationEventPublisher eventPublisher,
                          final RequestService requestService,
                          final ObjectMapper objectMapper,
                          final Mappers mappers);

}