|
@@ -43,5 +43,23 @@ public class PollController {
|
43
|
43
|
return new ResponseEntity<>(httpHeaders, HttpStatus.CREATED);
|
44
|
44
|
}
|
45
|
45
|
|
|
46
|
+ @RequestMapping(value = "/polls/{pollId}", method = RequestMethod.GET)
|
|
47
|
+ public ResponseEntity<?> getPoll(@PathVariable Long pollId){
|
|
48
|
+ Poll p = pollRepository.findOne(pollId);
|
|
49
|
+ return new ResponseEntity<>(p, HttpStatus.OK);
|
|
50
|
+ }
|
|
51
|
+
|
|
52
|
+ @RequestMapping(value = "/polls/{pollId}", method = RequestMethod.PUT)
|
|
53
|
+ public ResponseEntity<?> updatePoll(@RequestBody Poll poll, @PathVariable Long pollId){
|
|
54
|
+ Poll p = pollRepository.save(poll);
|
|
55
|
+ return new ResponseEntity<>(HttpStatus.OK);
|
|
56
|
+ }
|
|
57
|
+
|
|
58
|
+ @RequestMapping(value = "/polls{pollId}", method = RequestMethod.DELETE)
|
|
59
|
+ public ResponseEntity<?> deletePoll(@PathVariable Long pollId){
|
|
60
|
+ pollRepository.delete(pollId);
|
|
61
|
+ return new ResponseEntity<>(HttpStatus.OK);
|
|
62
|
+ }
|
|
63
|
+
|
46
|
64
|
|
47
|
65
|
}
|