feat: club set role
This commit is contained in:
@@ -10,6 +10,7 @@ import fr.titionfire.ffsaf.data.repository.CombRepository;
|
||||
import fr.titionfire.ffsaf.net2.ServerCustom;
|
||||
import fr.titionfire.ffsaf.net2.data.SimpleClubModel;
|
||||
import fr.titionfire.ffsaf.net2.request.SReqClub;
|
||||
import fr.titionfire.ffsaf.rest.data.DeskMember;
|
||||
import fr.titionfire.ffsaf.rest.data.RenewAffData;
|
||||
import fr.titionfire.ffsaf.rest.data.SimpleClubList;
|
||||
import fr.titionfire.ffsaf.rest.from.FullClubForm;
|
||||
@@ -36,6 +37,7 @@ import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static fr.titionfire.ffsaf.net2.Client_Thread.MAPPER;
|
||||
|
||||
@@ -128,6 +130,16 @@ public class ClubService {
|
||||
.call(club -> Mutiny.fetch(club.getContact()));
|
||||
}
|
||||
|
||||
public Uni<List<DeskMember>> getClubDesk(Consumer<ClubModel> consumer, long id) {
|
||||
return repository.findById(id).invoke(consumer)
|
||||
.chain(club -> combRepository.list("club = ?1", club))
|
||||
.map(combs -> combs.stream()
|
||||
.filter(o -> o.getRole() != null && o.getRole().level >= RoleAsso.MEMBREBUREAU.level)
|
||||
.sorted((o1, o2) -> o2.getRole().level - o1.getRole().level)
|
||||
.map(DeskMember::fromModel)
|
||||
.toList());
|
||||
}
|
||||
|
||||
public Uni<String> updateOfUser(JsonWebToken idToken, PartClubForm form) {
|
||||
TypeReference<HashMap<Contact, String>> typeRef = new TypeReference<>() {
|
||||
};
|
||||
@@ -245,7 +257,7 @@ public class ClubService {
|
||||
.call(__ -> Utils.deleteMedia(id, media, "clubStatus"));
|
||||
}
|
||||
|
||||
public Uni<RenewAffData> getRenewData(long id) {
|
||||
public Uni<RenewAffData> getRenewData(long id, List<Long> mIds) {
|
||||
RenewAffData data = new RenewAffData();
|
||||
|
||||
return repository.findById(id)
|
||||
@@ -260,11 +272,10 @@ public class ClubService {
|
||||
.map(AffiliationModel::getSaison).map(i -> Math.min(i + 1, Utils.getSaison() + 1))
|
||||
.orElse(Utils.getSaison()));
|
||||
})
|
||||
.chain(club -> combRepository.list("club = ?1", club))
|
||||
.chain(club -> combRepository.list("id IN ?1", mIds))
|
||||
.invoke(combs -> data.setMembers(combs.stream()
|
||||
.filter(o -> o.getRole() != null && o.getRole().level >= RoleAsso.MEMBREBUREAU.level)
|
||||
.sorted((o1, o2) -> o2.getRole().level - o1.getRole().level)
|
||||
.limit(3)
|
||||
.map(RenewAffData.RenewMember::new)
|
||||
.toList()))
|
||||
.map(o -> data);
|
||||
|
||||
Reference in New Issue
Block a user