dev #36

Merged
Thibaut merged 2 commits from dev into master 2025-03-14 23:19:03 +00:00
Showing only changes of commit c7b5f3ef61 - Show all commits

View File

@ -262,7 +262,6 @@ public class PouleService {
return repository.find("systemId = ?1 AND system = ?2", id, system).firstResult() return repository.find("systemId = ?1 AND system = ?2", id, system).firstResult()
.onItem().ifNull().failWith(() -> new RuntimeException("Poule not found")) .onItem().ifNull().failWith(() -> new RuntimeException("Poule not found"))
.call(o -> permService.hasEditPerm(securityCtx, o.getCompet())) .call(o -> permService.hasEditPerm(securityCtx, o.getCompet()))
.call(o -> Mutiny.fetch(o.getMatchs()))
.call(o -> Mutiny.fetch(o.getTree()) .call(o -> Mutiny.fetch(o.getTree())
.call(o2 -> o2.isEmpty() ? Uni.createFrom().nullItem() : .call(o2 -> o2.isEmpty() ? Uni.createFrom().nullItem() :
Uni.createFrom().item(o2.stream().peek(m -> { Uni.createFrom().item(o2.stream().peek(m -> {
@ -275,10 +274,7 @@ public class PouleService {
Panache.withTransaction(() -> treeRepository.delete("id IN ?1", in))) Panache.withTransaction(() -> treeRepository.delete("id IN ?1", in)))
) )
) )
.call(o -> o.getMatchs().isEmpty() ? Uni.createFrom().nullItem() : .call(o -> matchRepository.delete("poule.id = ?1", o.getId()))
Panache.withTransaction(() -> Uni.join().all(
o.getMatchs().stream().map(l -> matchRepository.deleteById(l.getId())).toList())
.andCollectFailures()))
.chain(model -> Panache.withTransaction(() -> repository.delete("id", model.getId()))); .chain(model -> Panache.withTransaction(() -> repository.delete("id", model.getId())));
} }
} }