mpierse 5 лет назад
Родитель
Сommit
c15e2c0ca0

+ 10
- 4
pom.xml Просмотреть файл

@@ -1,5 +1,4 @@
1
-
2
- <?xml version="1.0" encoding="UTF-8"?>
1
+<?xml version="1.0" encoding="UTF-8"?>
3 2
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 3
 	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5 4
 	<modelVersion>4.0.0</modelVersion>
@@ -15,7 +14,7 @@
15 14
 	<parent>
16 15
 		<groupId>org.springframework.boot</groupId>
17 16
 		<artifactId>spring-boot-starter-parent</artifactId>
18
-		<version>2.0.4.RELEASE</version>
17
+		<version>1.5.11.RELEASE</version>
19 18
 		<relativePath/> <!-- lookup parent from repository -->
20 19
 	</parent>
21 20
 
@@ -59,7 +58,14 @@
59 58
             <groupId>com.h2database</groupId>
60 59
             <artifactId>h2</artifactId>
61 60
         </dependency>
62
-    </dependencies>
61
+
62
+        <dependency>
63
+            <groupId>org.hsqldb</groupId>
64
+            <artifactId>hsqldb</artifactId>
65
+            <scope>runtime</scope>
66
+        </dependency>
67
+
68
+	</dependencies>
63 69
 
64 70
 	<build>
65 71
 		<plugins>

+ 4
- 6
src/main/java/com/zipcodewilmington/bakery/Controllers/BakerController.java Просмотреть файл

@@ -5,9 +5,7 @@ import com.zipcodewilmington.bakery.Repositories.BakerRepository;
5 5
 import org.springframework.beans.factory.annotation.Autowired;
6 6
 import org.springframework.http.HttpStatus;
7 7
 import org.springframework.http.ResponseEntity;
8
-import org.springframework.web.bind.annotation.GetMapping;
9
-import org.springframework.web.bind.annotation.RequestMapping;
10
-import org.springframework.web.bind.annotation.RestController;
8
+import org.springframework.web.bind.annotation.*;
11 9
 
12 10
 @RestController
13 11
 @RequestMapping
@@ -26,12 +24,12 @@ public class BakerController {
26 24
         return new ResponseEntity<>(this.bakerRepository.findOne(id), HttpStatus.OK);
27 25
     }
28 26
 
29
-    @GetMapping(value = "/baker")
27
+    @PostMapping(value = "/baker")
30 28
     public ResponseEntity<Baker> create(Baker baker) {
31 29
         return new ResponseEntity<>(this.bakerRepository.save(baker), HttpStatus.CREATED);
32 30
     }
33 31
 
34
-    @GetMapping(value = "/baker/{id}")
32
+    @PutMapping(value = "/baker/{id}")
35 33
     public ResponseEntity<Baker> update(Long id, Baker baker) {
36 34
         Baker foundBaker = bakerRepository.findOne(id);
37 35
 
@@ -41,7 +39,7 @@ public class BakerController {
41 39
         return new ResponseEntity<>(this.bakerRepository.save(foundBaker), HttpStatus.OK);
42 40
     }
43 41
 
44
-    @GetMapping(value = "/baker/{id}")
42
+    @DeleteMapping(value = "/baker/{id}")
45 43
     public ResponseEntity<Boolean> destroy(Long id) {
46 44
         this.bakerRepository.delete(id);
47 45
         return new ResponseEntity<>(true, HttpStatus.OK);

+ 4
- 7
src/main/java/com/zipcodewilmington/bakery/Controllers/MuffinController.java Просмотреть файл

@@ -5,10 +5,7 @@ import com.zipcodewilmington.bakery.Repositories.MuffinRepository;
5 5
 import org.springframework.beans.factory.annotation.Autowired;
6 6
 import org.springframework.http.HttpStatus;
7 7
 import org.springframework.http.ResponseEntity;
8
-import org.springframework.web.bind.annotation.GetMapping;
9
-import org.springframework.web.bind.annotation.RequestMapping;
10
-import org.springframework.web.bind.annotation.RequestMethod;
11
-import org.springframework.web.bind.annotation.RestController;
8
+import org.springframework.web.bind.annotation.*;
12 9
 
13 10
 @RestController
14 11
 @RequestMapping
@@ -26,12 +23,12 @@ public class MuffinController {
26 23
     public ResponseEntity<Muffin> show(Long id) {
27 24
         return new ResponseEntity<>(this.muffinRepository.findOne(id), HttpStatus.OK);
28 25
     }
29
-    @GetMapping(value = "/muffin")
26
+    @PostMapping(value = "/muffin")
30 27
     public ResponseEntity<Muffin> create(Muffin muffin) {
31 28
         return new ResponseEntity<>(this.muffinRepository.save(muffin), HttpStatus.CREATED);
32 29
     }
33 30
 
34
-    @GetMapping(value ="/muffin/{id}")
31
+    @PutMapping(value ="/muffin/{id}")
35 32
     public ResponseEntity<Muffin> update(Long id, Muffin muffin) {
36 33
         Muffin foundMuffin = muffinRepository.findOne(id);
37 34
         foundMuffin.setFlavor(muffin.getFlavor());
@@ -39,7 +36,7 @@ public class MuffinController {
39 36
         return new ResponseEntity<>(this.muffinRepository.save(foundMuffin), HttpStatus.OK);
40 37
     }
41 38
 
42
-    @GetMapping(value = "/muffin/{id}")
39
+    @DeleteMapping(value = "/muffin/{id}")
43 40
     public ResponseEntity<Boolean> destroy(Long id) {
44 41
         this.muffinRepository.delete(id);
45 42
         return new ResponseEntity<>(true, HttpStatus.OK);