Some checks failed
CI/CD Pipeline / pipeline (push) Failing after 3m46s
Le commita72ab54(chore docker Dockerfile racine) a involontairement balayé des fichiers du commit31330d9(PI-SPI, KYC, RLS, mutuelle parts, comptabilité PDF) lors d'un git add -A trop large. Restauration de l'intégralité des fichiers depuis a72ab54^ : - 11 migrations Flyway V32-V42 (parts sociales, SYSCOHADA, Keycloak Org Id, KYC, RLS, Provider défaut, FCM, App DB Roles) - Package payment/pispi/ complet (PispiAuth, PispiClient, PispiIso20022Mapper, PispiSignatureVerifier, PispiWebhookResource, dto/Pacs008Request, dto/Pacs002Response, PispiPaymentProvider) - Package payment/{wave,orangemoney,mtnmomo}/* (PaymentProvider impls) - Package payment/orchestration/ (PaymentOrchestrator, PaymentProviderRegistry) - Entités KycDossier, mutuelle/parts/* (ComptePartsSociales, TransactionPartsSociales) - Mappers, repositories, resources associés - Services KycAmlService, ComptabilitePdfService, ReleveComptePdfService, InteretsEpargneService - AdminKeycloakOrganisationResource, KycResource, PaiementUnifieResource - Tests unitaires PI-SPI, KYC, mutuelle parts
65 lines
2.3 KiB
Java
65 lines
2.3 KiB
Java
package dev.lions.unionflow.server.resource;
|
|
|
|
import dev.lions.unionflow.server.service.MigrerOrganisationsVersKeycloakService;
|
|
import dev.lions.unionflow.server.service.MigrerOrganisationsVersKeycloakService.MigrationReport;
|
|
import jakarta.annotation.security.RolesAllowed;
|
|
import jakarta.inject.Inject;
|
|
import jakarta.ws.rs.POST;
|
|
import jakarta.ws.rs.Path;
|
|
import jakarta.ws.rs.Produces;
|
|
import jakarta.ws.rs.core.MediaType;
|
|
import jakarta.ws.rs.core.Response;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* Endpoints d'administration Keycloak 26 Organizations.
|
|
*
|
|
* <p>Réservés aux SUPER_ADMIN. Opérations à déclencher manuellement lors de la
|
|
* migration Keycloak 23 → 26.
|
|
*/
|
|
@Slf4j
|
|
@Path("/api/admin/keycloak")
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
@RolesAllowed("SUPER_ADMIN")
|
|
public class AdminKeycloakOrganisationResource {
|
|
|
|
@Inject
|
|
MigrerOrganisationsVersKeycloakService migrationService;
|
|
|
|
/**
|
|
* Lance la migration one-shot des organisations UnionFlow vers Keycloak 26 Organizations.
|
|
*
|
|
* <p>Idempotent : les organisations déjà migrées (keycloak_org_id non null) sont ignorées.
|
|
*
|
|
* @return rapport de migration (total, créés, ignorés, erreurs)
|
|
*/
|
|
@POST
|
|
@Path("/migrer-organisations")
|
|
public Response migrerOrganisations() {
|
|
log.info("Déclenchement migration organisations → Keycloak 26 Organizations");
|
|
try {
|
|
MigrationReport report = migrationService.migrerToutesLesOrganisations();
|
|
log.info("Migration terminée : {}", report);
|
|
|
|
return Response
|
|
.status(report.success() ? Response.Status.OK.getStatusCode() : 207)
|
|
.entity(Map.of(
|
|
"total", report.total(),
|
|
"crees", report.crees(),
|
|
"ignores", report.ignores(),
|
|
"erreurs", report.erreurs(),
|
|
"succes", report.success()
|
|
))
|
|
.build();
|
|
|
|
} catch (Exception e) {
|
|
log.error("Erreur critique lors de la migration : {}", e.getMessage(), e);
|
|
return Response.serverError()
|
|
.entity(Map.of("error", e.getMessage()))
|
|
.build();
|
|
}
|
|
}
|
|
}
|