package io.fundreqest.platform.tweb.request;

import io.fundreqest.platform.tweb.infrastructure.mav.AbstractController;
import io.fundrequest.core.request.RequestService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class RequestController extends AbstractController {

    private RequestService requestService;

    public RequestController(RequestService requestService) {
        this.requestService = requestService;
    }

    @RequestMapping("/requests")
    public ModelAndView requests() {
        return modelAndView()
                .withObject("requests", requestService.findAll())
                .withView("pages/requests/index")
                .build();
    }

    @RequestMapping("/requests/{id}")
    public ModelAndView details(@PathVariable Long id) {
        return modelAndView()
                .withObject("request", requestService.findRequest(id))
                .withView("pages/requests/detail")
                .build();
    }


}

@@ -175,110 +175,337 @@
 ort 
-org.springframework.stereotype.Controller;%0Aimport org.springframework.web.bind.annotation.PathVariable
+io.fundrequest.core.request.fund.CreateERC67FundRequest;%0Aimport org.springframework.http.MediaType;%0Aimport org.springframework.stereotype.Controller;%0Aimport org.springframework.web.bind.annotation.PathVariable;%0Aimport org.springframework.web.bind.annotation.PostMapping;%0Aimport org.springframework.web.bind.annotation.RequestBody
 ;%0Aim
@@ -619,16 +619,48 @@
 dView;%0A%0A
+import javax.validation.Valid;%0A%0A
 @Control
@@ -1412,11 +1412,298 @@
 %0A    %7D%0A%0A
+    @PostMapping(value = %7B%22/rest/requests/%7Bid%7D/erc67/fund%22%7D, produces = MediaType.TEXT_PLAIN_VALUE)%0A    public String generateERC67ForFunding(@RequestBody @Valid CreateERC67FundRequest createERC67FundRequest) %7B%0A        return requestService.generateERC67(createERC67FundRequest);%0A    %7D%0A%0A
 %0A%7D%0A

add erc67 endpoint