|
@@ -3,6 +3,7 @@ package com.zipcodewilmington.bakery.Controllers;
|
3
|
3
|
import com.zipcodewilmington.bakery.Models.Baker;
|
4
|
4
|
import com.zipcodewilmington.bakery.Repositories.BakerRepository;
|
5
|
5
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
6
|
+import org.springframework.data.rest.core.annotation.RepositoryEventHandler;
|
6
|
7
|
import org.springframework.http.HttpStatus;
|
7
|
8
|
import org.springframework.http.ResponseEntity;
|
8
|
9
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -18,8 +19,8 @@ public class BakerController {
|
18
|
19
|
return new ResponseEntity<>(this.bakerRepository.findAll(), HttpStatus.OK);
|
19
|
20
|
}
|
20
|
21
|
|
21
|
|
- @GetMapping("/bakers")
|
22
|
|
- public ResponseEntity<Baker> show(Long id) {
|
|
22
|
+ @GetMapping("/bakers/{id}")
|
|
23
|
+ public ResponseEntity<Baker> show(@PathVariable Long id) {
|
23
|
24
|
return new ResponseEntity<>(this.bakerRepository.findOne(id), HttpStatus.OK);
|
24
|
25
|
}
|
25
|
26
|
|
|
@@ -38,7 +39,7 @@ public class BakerController {
|
38
|
39
|
return new ResponseEntity<>(this.bakerRepository.save(foundBaker), HttpStatus.OK);
|
39
|
40
|
}
|
40
|
41
|
|
41
|
|
- @DeleteMapping("/bakers")
|
|
42
|
+ @DeleteMapping("/bakers/")
|
42
|
43
|
public ResponseEntity<Boolean> destroy(Long id) {
|
43
|
44
|
this.bakerRepository.delete(id);
|
44
|
45
|
return new ResponseEntity<>(true, HttpStatus.OK);
|