feat: admin club filter fetch all club

fix: log null update case
This commit is contained in:
2025-07-05 14:11:05 +02:00
parent 1e260caddb
commit 3fd5ae3741
3 changed files with 44 additions and 22 deletions

View File

@@ -96,10 +96,17 @@ public class MembreService {
if (club == null || club.isBlank()) {
query = repository.find(FIND_NAME_REQUEST, Sort.ascending("fname", "lname"), search)
.page(Page.ofSize(limit));
} else
query = repository.find(
"LOWER(club.name) LIKE LOWER(?2) AND (" + FIND_NAME_REQUEST + ")",
Sort.ascending("fname", "lname"), search, club + "%").page(Page.ofSize(limit));
} else {
if (club.equals("null")) {
query = repository.find(
"club IS NULL AND (" + FIND_NAME_REQUEST + ")",
Sort.ascending("fname", "lname"), search).page(Page.ofSize(limit));
} else {
query = repository.find(
"LOWER(club.name) LIKE LOWER(?2) AND (" + FIND_NAME_REQUEST + ")",
Sort.ascending("fname", "lname"), search, club + "%").page(Page.ofSize(limit));
}
}
return getPageResult(query, limit, page);
}
@@ -202,7 +209,8 @@ public class MembreService {
}
model.setGenre(Genre.fromString(dataIn.getGenre()));
if (dataIn.getBirthdate() != null) {
if (!Objects.equals(model.getBirth_date().getTime(), dataIn.getBirthdate().getTime()))
if (model.getBirth_date() == null || !Objects.equals(model.getBirth_date().getTime(),
dataIn.getBirthdate().getTime()))
ls.logChange("Date de naissance", model.getBirth_date(), dataIn.getBirthdate(), model);
model.setBirth_date(dataIn.getBirthdate());
model.setCategorie(Utils.getCategoryFormBirthDate(model.getBirth_date(), new Date()));
@@ -301,7 +309,8 @@ public class MembreService {
target.setLname(membre.getLname().toUpperCase());
ls.logChange("Pays", target.getCountry(), membre.getCountry(), target);
target.setCountry(membre.getCountry());
if (!Objects.equals(target.getBirth_date().getTime(), membre.getBirth_date().getTime())) {
if (membre.getBirth_date() != null && (target.getBirth_date() == null || !Objects.equals(
target.getBirth_date().getTime(), membre.getBirth_date().getTime()))) {
ls.logChange("Date de naissance", target.getBirth_date(), membre.getBirth_date(), target);
target.setBirth_date(membre.getBirth_date());
target.setCategorie(Utils.getCategoryFormBirthDate(membre.getBirth_date(), new Date()));