Browse Source

check on non imported volunteer only

tripeur 4 years ago
parent
commit
6033f1deb2

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

@@ -167,7 +167,8 @@ public class ApiController {
     if (repository.findByUuid(uuid).size() == 0) {
       throw new ResponseStatusException(HttpStatus.NOT_FOUND, "",
           new EvenementNotFoundException(uuid));
-    } else if (repositoryVolunteer.findByEventUuidAndEmail(uuid, volunteer.getEmail()).size() > 0) {
+    } else if (repositoryVolunteer
+        .findByEventUuidAndEmailAndImportedFalse(uuid, volunteer.getEmail()).size() > 0) {
       throw new ResponseStatusException(HttpStatus.CONFLICT, "Email already existing");
     } else {
       volunteer.setEventUuid(uuid);

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

@@ -16,4 +16,6 @@ public interface RegistrationRepository extends CrudRepository<Volunteer, Long>
 
   List<Volunteer> findByEventUuidAndEmail(String uuid, String email);
 
+  List<Volunteer> findByEventUuidAndEmailAndImportedFalse(String uuid, String email);
+
 }