feat(comp): add more register data
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 6m25s
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 6m25s
This commit is contained in:
@@ -3,9 +3,7 @@ package fr.titionfire.ffsaf.domain.service;
|
||||
import fr.titionfire.ffsaf.data.model.ClubModel;
|
||||
import fr.titionfire.ffsaf.data.model.LicenceModel;
|
||||
import fr.titionfire.ffsaf.data.model.MembreModel;
|
||||
import fr.titionfire.ffsaf.data.repository.ClubRepository;
|
||||
import fr.titionfire.ffsaf.data.repository.CombRepository;
|
||||
import fr.titionfire.ffsaf.data.repository.LicenceRepository;
|
||||
import fr.titionfire.ffsaf.data.repository.*;
|
||||
import fr.titionfire.ffsaf.net2.ServerCustom;
|
||||
import fr.titionfire.ffsaf.net2.data.SimpleCombModel;
|
||||
import fr.titionfire.ffsaf.net2.request.SReqComb;
|
||||
@@ -37,9 +35,7 @@ import org.jboss.logging.Logger;
|
||||
|
||||
import java.io.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
@@ -55,6 +51,9 @@ public class MembreService {
|
||||
@Inject
|
||||
LicenceRepository licenceRepository;
|
||||
|
||||
@Inject
|
||||
CompetitionRepository competitionRepository;
|
||||
|
||||
@Inject
|
||||
ServerCustom serverCustom;
|
||||
@Inject
|
||||
@@ -65,6 +64,8 @@ public class MembreService {
|
||||
|
||||
@ConfigProperty(name = "pdf-maker.jar-path")
|
||||
String pdfMakerJarPath;
|
||||
@Inject
|
||||
RegisterRepository registerRepository;
|
||||
|
||||
public SimpleCombModel find(int licence, String np) throws Throwable {
|
||||
return VertxContextSupport.subscribeAndAwait(() -> Panache.withTransaction(() ->
|
||||
@@ -88,7 +89,8 @@ public class MembreService {
|
||||
query = repository.find("(LOWER(lname) LIKE LOWER(?1) OR LOWER(fname) LIKE LOWER(?1))",
|
||||
Sort.ascending("fname", "lname"), search).page(Page.ofSize(limit));
|
||||
else
|
||||
query = repository.find("LOWER(club.name) LIKE LOWER(?2) AND (LOWER(lname) LIKE LOWER(?1) OR LOWER(fname) LIKE LOWER(?1))",
|
||||
query = repository.find(
|
||||
"LOWER(club.name) LIKE LOWER(?2) AND (LOWER(lname) LIKE LOWER(?1) OR LOWER(fname) LIKE LOWER(?1))",
|
||||
Sort.ascending("fname", "lname"), search, club + "%").page(Page.ofSize(limit));
|
||||
return getPageResult(query, limit, page);
|
||||
}
|
||||
@@ -100,7 +102,8 @@ public class MembreService {
|
||||
String finalSearch = search;
|
||||
return repository.find("userId = ?1", subject).firstResult()
|
||||
.chain(membreModel -> {
|
||||
PanacheQuery<MembreModel> query = repository.find("club = ?1 AND (LOWER(lname) LIKE LOWER(?2) OR LOWER(fname) LIKE LOWER(?2))",
|
||||
PanacheQuery<MembreModel> query = repository.find(
|
||||
"club = ?1 AND (LOWER(lname) LIKE LOWER(?2) OR LOWER(fname) LIKE LOWER(?2))",
|
||||
Sort.ascending("fname", "lname"), membreModel.getClub(), finalSearch)
|
||||
.page(Page.ofSize(limit));
|
||||
return getPageResult(query, limit, page);
|
||||
@@ -170,6 +173,20 @@ public class MembreService {
|
||||
.call(membreModel -> (membreModel.getUserId() != null) ?
|
||||
keycloakService.setEmail(membreModel.getUserId(), membreModel.getEmail()) : Uni.createFrom()
|
||||
.nullItem())
|
||||
.call(membreModel -> {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DAY_OF_YEAR, -7);
|
||||
Date dateLimit = calendar.getTime();
|
||||
|
||||
return competitionRepository.list("date > ?1", dateLimit)
|
||||
.call(l ->
|
||||
Uni.join().all(l.stream().map(competitionModel ->
|
||||
registerRepository.update(
|
||||
"categorie = ?1, club = ?2 where competition = ?3 AND membre = ?4",
|
||||
membreModel.getCategorie(), membreModel.getClub(), competitionModel,
|
||||
membreModel)
|
||||
).toList()).andFailFast());
|
||||
})
|
||||
.map(__ -> "OK");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user