Browse Source

implement soft volunteer deletion

tripeur 4 years ago
parent
commit
c2dc18eab5

+ 20 - 0
hook.json

@@ -0,0 +1,20 @@
+[
+  {
+    "id": "redeploy-front",
+    "execute-command": "/home/clovis/bdlg/bdlgplanner.sh",
+    "command-working-directory": "/home/clovis/bdlg",
+    "pass-arguments-to-command":[
+      {"source":"string","name":"update"},
+      {"source":"string","name":"front"}
+    ]
+  },
+  {
+    "id": "redeploy-back",
+    "execute-command": "/home/clovis/bdlg/bdlgplanner.sh",
+    "command-working-directory": "/home/clovis/bdlg",
+    "pass-arguments-to-command":[
+      {"source":"string","name":"update"},
+      {"source":"string","name":"back"}
+    ]
+  }
+]

+ 3 - 2
src/main/java/fr/jaquin/bdlg/planner/controller/ApiController.java

@@ -159,7 +159,7 @@ public class ApiController {
 
   @GetMapping("/inscription/{uuid}")
   List<Volunteer> getVolunteers(@PathVariable String uuid) {
-    return repositoryVolunteer.findByEventUuid(uuid);
+    return repositoryVolunteer.findByEventUuidAndImportedFalse(uuid);
   }
 
   @PutMapping("/inscription/{uuid}")
@@ -179,7 +179,8 @@ public class ApiController {
   boolean deleteVolunteers(@PathVariable String uuid, @PathVariable Long id) {
     Optional<Volunteer> v = repositoryVolunteer.findById(id);
     if (v.isPresent()) {
-      repositoryVolunteer.delete(v.get());
+      v.get().setImported(true);
+      repositoryVolunteer.save(v.get());
       return true;
     }
     return false;

+ 13 - 0
src/main/java/fr/jaquin/bdlg/planner/persistence/Volunteer.java

@@ -22,6 +22,7 @@ public class Volunteer {
   private String phone;
   private String email;
   private String comment;
+  private Boolean imported;
 
   @ElementCollection
   @CollectionTable(name = "volunteer_competencies",
@@ -98,4 +99,16 @@ public class Volunteer {
     this.competenceIdList = competenceIdList;
   }
 
+  public Boolean isImported() {
+    return this.imported;
+  }
+
+  public Boolean getImported() {
+    return this.imported;
+  }
+
+  public void setImported(Boolean imported) {
+    this.imported = imported;
+  }
+
 }

+ 2 - 0
src/main/java/fr/jaquin/bdlg/planner/persistence/repositories/RegistrationRepository.java

@@ -12,6 +12,8 @@ public interface RegistrationRepository extends CrudRepository<Volunteer, Long>
 
   List<Volunteer> findByEventUuid(String uuid);
 
+  List<Volunteer> findByEventUuidAndImportedFalse(String uuid);
+
   List<Volunteer> findByEventUuidAndEmail(String uuid, String email);
 
 }