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

@@ -112,6 +112,10 @@ public class LicenceService {
public Uni<?> deleteAskLicence(long id, Consumer<MembreModel> checkPerm) {
return repository.findById(id)
.call(licenceModel -> Mutiny.fetch(licenceModel.getMembre()).invoke(checkPerm))
.invoke(Unchecked.consumer(licenceModel -> {
if (licenceModel.isValidate())
throw new DBadRequestException("Impossible de supprimer une licence déjà validée");
}))
.chain(__ -> Panache.withTransaction(() -> repository.deleteById(id)));
}
}