feat: club filter
This commit is contained in:
@@ -277,15 +277,13 @@ public class AffiliationService {
|
||||
}
|
||||
|
||||
public Uni<List<SimpleAffiliation>> getCurrentSaisonAffiliation() {
|
||||
return repository.list("saison = ?1", Utils.getSaison())
|
||||
.map(models -> models.stream().map(SimpleAffiliation::fromModel).toList())
|
||||
.chain(aff -> repositoryRequest.list("saison = ?1", Utils.getSaison())
|
||||
.chain(models -> Uni.join().all(models.stream().map(model ->
|
||||
clubRepository.find("SIRET = ?1", model.getSiret()).firstResult()
|
||||
.map(c -> new SimpleAffiliation(model.getId() * -1, c.getId(),
|
||||
model.getSaison(), false)))
|
||||
.toList()).andFailFast()
|
||||
).map(aff2 -> Stream.concat(aff2.stream(), aff.stream()).toList())
|
||||
return repositoryRequest.list("saison = ?1 or saison = ?1 + 1", Utils.getSaison())
|
||||
.map(models -> models.stream()
|
||||
.map(model -> new SimpleAffiliation(model.getId() * -1, model.getSiret(), model.getSaison(),
|
||||
false)).toList())
|
||||
.chain(aff -> repository.list("saison = ?1", Utils.getSaison())
|
||||
.map(models -> models.stream().map(SimpleAffiliation::fromModel).toList())
|
||||
.map(aff2 -> Stream.concat(aff2.stream(), aff.stream()).toList())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,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.SimpleClubList;
|
||||
import fr.titionfire.ffsaf.rest.from.FullClubForm;
|
||||
import fr.titionfire.ffsaf.utils.Contact;
|
||||
import fr.titionfire.ffsaf.utils.PageResult;
|
||||
@@ -74,7 +75,7 @@ public class ClubService {
|
||||
});
|
||||
}
|
||||
|
||||
public Uni<PageResult<SimpleClubModel>> search(Integer limit, int page, String search, String country) {
|
||||
public Uni<PageResult<SimpleClubList>> search(Integer limit, int page, String search, String country) {
|
||||
if (search == null)
|
||||
search = "";
|
||||
search = search + "%";
|
||||
@@ -90,8 +91,8 @@ public class ClubService {
|
||||
return getPageResult(query, limit, page);
|
||||
}
|
||||
|
||||
private Uni<PageResult<SimpleClubModel>> getPageResult(PanacheQuery<ClubModel> query, int limit, int page) {
|
||||
return Uni.createFrom().item(new PageResult<SimpleClubModel>())
|
||||
private Uni<PageResult<SimpleClubList>> getPageResult(PanacheQuery<ClubModel> query, int limit, int page) {
|
||||
return Uni.createFrom().item(new PageResult<SimpleClubList>())
|
||||
.invoke(result -> result.setPage(page))
|
||||
.invoke(result -> result.setPage_size(limit))
|
||||
.call(result -> query.count().invoke(result::setResult_count))
|
||||
@@ -101,7 +102,7 @@ public class ClubService {
|
||||
}))
|
||||
.invoke(result::setPage_count))
|
||||
.call(result -> query.page(Page.of(page, limit)).list()
|
||||
.map(membreModels -> membreModels.stream().map(SimpleClubModel::fromModel).toList())
|
||||
.map(membreModels -> membreModels.stream().map(SimpleClubList::fromModel).toList())
|
||||
.invoke(result::setResult));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user