From 87d1b83f052045fe9ae904a762a28725726d82b8 Mon Sep 17 00:00:00 2001 From: Vincent Zwingmann Date: Thu, 6 Jun 2024 15:19:45 +0200 Subject: [PATCH] ajout de getBudgets sorted --- .../operations/spi/OperationDatabaseAdaptor.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/operations/src/main/java/io/github/vzwingma/finances/budget/serverless/services/operations/spi/OperationDatabaseAdaptor.java b/operations/src/main/java/io/github/vzwingma/finances/budget/serverless/services/operations/spi/OperationDatabaseAdaptor.java index 564a2b8..b6bc287 100644 --- a/operations/src/main/java/io/github/vzwingma/finances/budget/serverless/services/operations/spi/OperationDatabaseAdaptor.java +++ b/operations/src/main/java/io/github/vzwingma/finances/budget/serverless/services/operations/spi/OperationDatabaseAdaptor.java @@ -7,6 +7,7 @@ import io.github.vzwingma.finances.budget.services.communs.data.trace.BusinessTraceContext; import io.github.vzwingma.finances.budget.services.communs.data.trace.BusinessTraceContextKeyEnum; import io.github.vzwingma.finances.budget.services.communs.utils.exceptions.BudgetNotFoundException; +import io.quarkus.panache.common.Sort; import io.smallrye.mutiny.Multi; import io.smallrye.mutiny.Uni; import jakarta.enterprise.context.ApplicationScoped; @@ -91,14 +92,14 @@ public Uni chargeBudgetMensuel(String idBudget) { @Override public Multi chargeBudgetsMensuels(String idCompte){ LOGGER.info("Chargement des budgets "); - return find(ATTRIBUT_COMPTE_ID + "=?1", idCompte) + return find(ATTRIBUT_COMPTE_ID + "=?1", idCompte, Sort.by("id")) .stream() .onFailure() - .transform(e -> { - LOGGER.error("Erreur lors du chargement des budgets de {}", idCompte, e); - return new BudgetNotFoundException("Erreur lors du chargement des budgets " + idCompte); - }) - .invoke(budget -> LOGGER.debug("-> Réception du budget {}. {} opérations", budget.getId(), budget.getListeOperations().size())); + .transform(e -> { + LOGGER.error("Erreur lors du chargement des budgets de {}", idCompte, e); + return new BudgetNotFoundException("Erreur lors du chargement des budgets " + idCompte); + }) + .invoke(budget -> LOGGER.debug("-> {} : {} opérations", budget.getId(), budget.getListeOperations().size())); } /**