|
|
@@ -1,6 +1,7 @@
|
|
1
|
1
|
package io.zipcoder.tc_spring_poll_application.controller;
|
|
2
|
2
|
|
|
3
|
3
|
import io.zipcoder.tc_spring_poll_application.domain.Poll;
|
|
|
4
|
+import io.zipcoder.tc_spring_poll_application.exception.ResourceNotFoundException;
|
|
4
|
5
|
import io.zipcoder.tc_spring_poll_application.repositories.PollRepository;
|
|
5
|
6
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
6
|
7
|
import org.springframework.http.HttpHeaders;
|
|
|
@@ -59,4 +60,12 @@ public class PollController {
|
|
59
|
60
|
return new ResponseEntity<>(HttpStatus.OK);
|
|
60
|
61
|
}
|
|
61
|
62
|
|
|
|
63
|
+
|
|
|
64
|
+ @RequestMapping(method = RequestMethod.GET)
|
|
|
65
|
+ public void verifyPoll(Poll poll) throws ResourceNotFoundException {
|
|
|
66
|
+ if (pollRepository.findOne(poll.getId()) == null) {
|
|
|
67
|
+ throw new ResourceNotFoundException();
|
|
|
68
|
+ }
|
|
|
69
|
+ }
|
|
|
70
|
+
|
|
62
|
71
|
}
|