rajah před 1 rokem
rodič
revize
1370d649e9

+ 8 - 2
src/main/java/fr/triplea/demovote/web/controller/BulletinController.java

@@ -1,5 +1,8 @@
 package fr.triplea.demovote.web.controller;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
@@ -125,11 +128,14 @@ public class BulletinController
 
   @DeleteMapping(value = "/delete/{id}")
   //@PreAuthorize("hasRole('PAGE_VOTER')")
-  public ResponseEntity<Object> remove(@PathVariable int id) 
+  public ResponseEntity<Map<String, Boolean>> remove(@PathVariable int id) 
   { 
     if (id > 0) { bulletinRepository.deleteById(id); }
     
-    return ResponseEntity.status(HttpStatus.ACCEPTED).build(); 
+    Map<String, Boolean> response = new HashMap<>();
+    response.put("deleted", Boolean.TRUE);
+    
+    return ResponseEntity.ok(response); 
   }
 
 }

+ 8 - 3
src/main/java/fr/triplea/demovote/web/controller/CategorieController.java

@@ -1,6 +1,8 @@
 package fr.triplea.demovote.web.controller;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
@@ -84,9 +86,9 @@ public class CategorieController
     return ResponseEntity.notFound().build(); 
   }
 
-  @DeleteMapping(value = "/retire/{id}")
+  @DeleteMapping(value = "/delete/{id}")
   //@PreAuthorize("hasRole('LISTE_CATEGORIES')")
-  public ResponseEntity<Object> disableCategorie(@PathVariable int id) 
+  public ResponseEntity<Map<String, Boolean>> disableCategorie(@PathVariable int id) 
   { 
     Categorie c = categorieRepository.getReferenceById(id);
     
@@ -96,7 +98,10 @@ public class CategorieController
       
       categorieRepository.saveAndFlush(c);
 
-      return ResponseEntity.status(HttpStatus.FOUND).build();  
+      Map<String, Boolean> response = new HashMap<>();
+      response.put("deleted", Boolean.TRUE);
+      
+      return ResponseEntity.ok(response); 
     }      
     
     return ResponseEntity.notFound().build(); 

+ 7 - 2
src/main/java/fr/triplea/demovote/web/controller/ParticipantController.java

@@ -1,6 +1,8 @@
 package fr.triplea.demovote.web.controller;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
@@ -111,7 +113,7 @@ public class ParticipantController
 
   @DeleteMapping(value = "/delete/{id}")
   //@PreAuthorize("hasRole('LISTE_PARTICIPANTS')")
-  public ResponseEntity<Object> disableParticipant(@PathVariable int id) 
+  public ResponseEntity<Map<String, Boolean>> disableParticipant(@PathVariable int id) 
   { 
     Participant found = participantRepository.getReferenceById(id);
     
@@ -121,7 +123,10 @@ public class ParticipantController
       
       participantRepository.saveAndFlush(found);
 
-      return ResponseEntity.ok().build();  
+      Map<String, Boolean> response = new HashMap<>();
+      response.put("deleted", Boolean.TRUE);
+      
+      return ResponseEntity.ok(response); 
     }      
     
     return ResponseEntity.notFound().build(); 

+ 7 - 2
src/main/java/fr/triplea/demovote/web/controller/ProductionController.java

@@ -1,7 +1,9 @@
 package fr.triplea.demovote.web.controller;
 
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
@@ -102,7 +104,7 @@ public class ProductionController
 
   @DeleteMapping(value = "/delete/{id}")
   //@PreAuthorize("hasAnyRole('LISTE_PRODUCTIONS_ADMIN', 'LISTE_PRODUCTIONS_USER')")
-  public ResponseEntity<Object> disableProduction(@PathVariable int id) 
+  public ResponseEntity<Map<String, Boolean>> disableProduction(@PathVariable int id) 
   { 
     Production found = productionRepository.getReferenceById(id);
     
@@ -112,7 +114,10 @@ public class ProductionController
       
       productionRepository.saveAndFlush(found);
       
-      return ResponseEntity.ok().build();
+      Map<String, Boolean> response = new HashMap<>();
+      response.put("deleted", Boolean.TRUE);
+      
+      return ResponseEntity.ok(response); 
     }      
     
     return ResponseEntity.notFound().build(); 

+ 7 - 2
src/main/java/fr/triplea/demovote/web/controller/VariableController.java

@@ -1,7 +1,9 @@
 package fr.triplea.demovote.web.controller;
 
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
@@ -84,7 +86,7 @@ public class VariableController
 
   @DeleteMapping(value = "/delete/{id}")
   //@PreAuthorize("hasRole('LISTE_VARIABLES')")
-  public ResponseEntity<Object> deleteVariable(@PathVariable int id) 
+  public ResponseEntity<Map<String, Boolean>> deleteVariable(@PathVariable int id) 
   { 
     Variable found = variableRepository.findById(id);
 
@@ -92,7 +94,10 @@ public class VariableController
     { 
       variableRepository.deleteById(id); 
       
-      return ResponseEntity.ok().build();
+      Map<String, Boolean> response = new HashMap<>();
+      response.put("deleted", Boolean.TRUE);
+      
+      return ResponseEntity.ok(response); 
     }
     
     return ResponseEntity.notFound().build();