feat: admin club filter fetch all club
fix: log null update case
This commit is contained in:
@@ -86,7 +86,9 @@ public class LoggerService {
|
||||
public void logChange(String champ, Object o1, Object o2, LoggableModel model) {
|
||||
if (Objects.equals(o1, o2))
|
||||
return;
|
||||
log(ActionType.UPDATE, champ + ": " + o1.toString() + " -> " + o2.toString(), model);
|
||||
log(ActionType.UPDATE,
|
||||
champ + ": " + (o1 == null ? "null" : o1.toString()) + " -> " + (o2 == null ? "null" : o2.toString()),
|
||||
model);
|
||||
}
|
||||
|
||||
public void logDelete(LoggableModel model) {
|
||||
|
||||
@@ -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()));
|
||||
|
||||
Reference in New Issue
Block a user