feat: translate backend
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 7m23s
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 7m23s
This commit is contained in:
@@ -79,6 +79,9 @@ public class AffiliationService {
|
||||
@ConfigProperty(name = "notif.affRequest.mail")
|
||||
List<String> mails;
|
||||
|
||||
@Inject
|
||||
TradService trad;
|
||||
|
||||
public Uni<List<AffiliationRequestModel>> getAllReq() {
|
||||
return repositoryRequest.listAll();
|
||||
}
|
||||
@@ -92,7 +95,7 @@ public class AffiliationService {
|
||||
return Uni.createFrom().item(affModel)
|
||||
.invoke(Unchecked.consumer(model -> {
|
||||
if (model.getSaison() != currentSaison && model.getSaison() != currentSaison + 1) {
|
||||
throw new DBadRequestException("Saison non valid");
|
||||
throw new DBadRequestException(trad.t("saison.non.valid"));
|
||||
}
|
||||
}))
|
||||
.chain(() -> ((affModel.getState_id().charAt(0) == 'W') ? stateIdService.get_rna(
|
||||
@@ -110,7 +113,7 @@ public class AffiliationService {
|
||||
out, affModel.getSaison()))
|
||||
.onItem().invoke(Unchecked.consumer(count -> {
|
||||
if (count != 0 && unique) {
|
||||
throw new DBadRequestException("Demande d'affiliation déjà existante");
|
||||
throw new DBadRequestException(trad.t("demande.d.affiliation.deja.existante"));
|
||||
}
|
||||
}))
|
||||
)
|
||||
@@ -118,28 +121,28 @@ public class AffiliationService {
|
||||
repository.count("club = ?1 and saison = ?2", club, affModel.getSaison())))
|
||||
.onItem().invoke(Unchecked.consumer(count -> {
|
||||
if (count != 0) {
|
||||
throw new DBadRequestException("Affiliation déjà existante");
|
||||
throw new DBadRequestException(trad.t("affiliation.deja.existante"));
|
||||
}
|
||||
}))
|
||||
.map(o -> affModel)
|
||||
.call(model -> ((model.getM1_lincence() != -1) ? combRepository.find("licence",
|
||||
model.getM1_lincence()).count().invoke(Unchecked.consumer(count -> {
|
||||
if (count == 0) {
|
||||
throw new DBadRequestException("Licence membre n°1 inconnue");
|
||||
throw new DBadRequestException(trad.t("licence.membre.n.1.inconnue"));
|
||||
}
|
||||
})) : Uni.createFrom().nullItem())
|
||||
)
|
||||
.call(model -> ((model.getM2_lincence() != -1) ? combRepository.find("licence",
|
||||
model.getM2_lincence()).count().invoke(Unchecked.consumer(count -> {
|
||||
if (count == 0) {
|
||||
throw new DBadRequestException("Licence membre n°2 inconnue");
|
||||
throw new DBadRequestException(trad.t("licence.membre.n.2.inconnue"));
|
||||
}
|
||||
})) : Uni.createFrom().nullItem())
|
||||
)
|
||||
.call(model -> ((model.getM3_lincence() != -1) ? combRepository.find("licence",
|
||||
model.getM3_lincence()).count().invoke(Unchecked.consumer(count -> {
|
||||
if (count == 0) {
|
||||
throw new DBadRequestException("Licence membre n°3 inconnue");
|
||||
throw new DBadRequestException(trad.t("licence.membre.n.3.inconnue"));
|
||||
}
|
||||
})) : Uni.createFrom().nullItem())
|
||||
);
|
||||
@@ -148,7 +151,7 @@ public class AffiliationService {
|
||||
public Uni<?> saveEdit(AffiliationRequestForm form) {
|
||||
return pre_save(form, false)
|
||||
.chain(model -> repositoryRequest.findById(form.getId())
|
||||
.onItem().ifNull().failWith(new DNotFoundException("Demande d'affiliation non trouvé"))
|
||||
.onItem().ifNull().failWith(new DNotFoundException(trad.t("demande.d.affiliation.non.trouve")))
|
||||
.chain(origine -> {
|
||||
origine.setName(model.getName());
|
||||
origine.setAddress(model.getAddress());
|
||||
@@ -201,7 +204,7 @@ public class AffiliationService {
|
||||
LOGGER.debug(form.toString());
|
||||
|
||||
return repositoryRequest.findById(form.getId())
|
||||
.onItem().ifNull().failWith(new DNotFoundException("Demande d'affiliation non trouvé"))
|
||||
.onItem().ifNull().failWith(new DNotFoundException(trad.t("demande.d.affiliation.non.trouve")))
|
||||
.map(model -> {
|
||||
model.setName(form.getName());
|
||||
model.setState_id(form.getState_id());
|
||||
@@ -306,7 +309,7 @@ public class AffiliationService {
|
||||
LOGGER.debug(form.toString());
|
||||
|
||||
return repositoryRequest.findById(form.getId())
|
||||
.onItem().ifNull().failWith(new DNotFoundException("Demande d'affiliation non trouvé"))
|
||||
.onItem().ifNull().failWith(new DNotFoundException(trad.t("demande.d.affiliation.non.trouve")))
|
||||
.chain(req ->
|
||||
clubRepository.find("StateId = ?1", form.getState_id()).firstResult()
|
||||
.chain(model -> (model == null) ? acceptNew(form, req) : acceptOld(form, req, model))
|
||||
@@ -398,7 +401,7 @@ public class AffiliationService {
|
||||
|
||||
public Uni<SimpleReqAffiliation> getRequest(long id) {
|
||||
return repositoryRequest.findById(id).map(SimpleReqAffiliation::fromModel)
|
||||
.onItem().ifNull().failWith(new DNotFoundException("Demande d'affiliation non trouvé"))
|
||||
.onItem().ifNull().failWith(new DNotFoundException(trad.t("demande.d.affiliation.non.trouve")))
|
||||
.call(out -> clubRepository.find("StateId = ?1", out.getStateId()).firstResult().invoke(c -> {
|
||||
if (c != null) {
|
||||
out.setClub(c.getId());
|
||||
@@ -422,7 +425,7 @@ public class AffiliationService {
|
||||
|
||||
public Uni<List<SimpleAffiliation>> getAffiliation(long id) {
|
||||
return clubRepository.findById(id)
|
||||
.onItem().ifNull().failWith(new DNotFoundException("Club non trouvé"))
|
||||
.onItem().ifNull().failWith(new DNotFoundException(trad.t("club.non.trouve")))
|
||||
.call(model -> Mutiny.fetch(model.getAffiliations()))
|
||||
.chain(model -> repositoryRequest.list("state_id = ?1", model.getStateId())
|
||||
.map(reqs -> reqs.stream().map(req ->
|
||||
@@ -434,11 +437,11 @@ public class AffiliationService {
|
||||
|
||||
public Uni<SimpleAffiliation> setAffiliation(long id, int saison) {
|
||||
return clubRepository.findById(id)
|
||||
.onItem().ifNull().failWith(new DNotFoundException("Club non trouvé"))
|
||||
.onItem().ifNull().failWith(new DNotFoundException(trad.t("club.non.trouve")))
|
||||
.call(model -> Mutiny.fetch(model.getAffiliations()))
|
||||
.invoke(Unchecked.consumer(club -> {
|
||||
if (club.getAffiliations().stream().anyMatch(affiliation -> affiliation.getSaison() == saison)) {
|
||||
throw new DBadRequestException("Affiliation déjà existante");
|
||||
throw new DBadRequestException(trad.t("affiliation.deja.existante"));
|
||||
}
|
||||
}))
|
||||
.chain(club ->
|
||||
|
||||
Reference in New Issue
Block a user