wpfat23-5 2 лет назад
Родитель
Сommit
c0f3fa590a

+ 5 - 0
pom.xml

@@ -88,6 +88,11 @@
             <groupId>org.postgresql</groupId>
             <artifactId>postgresql</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.10.1</version>
+        </dependency>
 
     </dependencies>
     <dependencyManagement>

+ 2 - 0
src/main/java/com/deliveryproject/easydelivery/AppUserController.java

@@ -38,6 +38,7 @@ public class AppUserController {
         return new ResponseEntity<>(users, HttpStatus.OK);
     }
 
+/*
     @PutMapping("/{id}")
     public ResponseEntity<AppUser> updateUser(@PathVariable Long id, @RequestBody AppUser user) {
         Optional<AppUser> userOptional = userRepository.findById(id);
@@ -48,6 +49,7 @@ public class AppUserController {
         }
         return new ResponseEntity<>(HttpStatus.NOT_FOUND);
     }
+*/
 
     @PutMapping("/{name}")
     public ResponseEntity<AppUser> addDeliveryToTheUser(@PathVariable String name, @RequestBody Delivery delivery) {

+ 3 - 1
src/main/java/com/deliveryproject/easydelivery/PostConstructInit.java

@@ -4,6 +4,7 @@ import com.deliveryproject.easydelivery.Models.AppUser;
 import com.deliveryproject.easydelivery.Models.Delivery;
 import com.deliveryproject.easydelivery.Models.Packet;
 import com.deliveryproject.easydelivery.Utils.RandomAddressGenerator;
+import com.google.gson.Gson;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -40,7 +41,8 @@ public class PostConstructInit {
             ArrayList<Packet> packets = new ArrayList<>();
             packets.add(packet);
             delivery.setPackets(packets);
-            System.out.println("aaaaaaa");
+            String jsonInString = new Gson().toJson(delivery);
+            System.out.println(jsonInString);
             appUserController.addDeliveryToTheUser("user2", delivery);
         }