feat: add licence and user remove condition check

This commit is contained in:
2025-07-02 19:02:46 +02:00
parent 5ce5df950f
commit 0c4b88b5cd
3 changed files with 15 additions and 4 deletions

View File

@@ -368,6 +368,12 @@ public class MembreService {
if (!securityCtx.isInClubGroup(membreModel.getClub().getId()))
throw new DForbiddenException();
}))
.invoke(Unchecked.consumer(membreModel -> {
if (membreModel.getLicence() != null) {
throw new DBadRequestException(
"Impossible de supprimer un membre qui a déjà un numéro de licence");
}
}))
.call(membreModel -> licenceRepository.find("membre = ?1", membreModel).count()
.invoke(Unchecked.consumer(l -> {
if (l > 0)