Files
unionflow-client-quarkus-pr…/src/main/java/dev/lions/unionflow/client/service/AuditTrailRestClient.java
dahoud fcaac36a14 feat(sprint-15 web 2026-04-25): Live Activity Feed page (transparency operations)
Page consommant /api/audit-trail/recent avec auto-refresh PrimeFaces toutes les 10s.
Transparency opérationnelle UnionFlow — chaque utilisateur voit selon son scope.

REST client AuditTrailRestClient
- Nouvelle méthode recent(scope, orgId, userId, limit)

Bean LiveFeedBean (@ViewScoped)
- Polling pilote externe via p:poll interval=10
- 3 scopes : SELF (défaut, n'importe quel rôle), ORG (admin/officer), ALL (compliance/contrôleur)
- Helpers : couleurAction (8 mappings), couleurSod (3 cas), tempsRelatif (s/m/h/j/futur)
- Limit clamp [1, 500]
- Compteur de refresh visible dans l'UI (debug)

Page /pages/secure/conformite/live-feed.xhtml
- Panel scope avec selectOneMenu + p:ajax change → rafraîchir
- Conditional inputs : orgId si scope=ORG, userId si scope=SELF
- p:poll interval=10 listener=rafraichir autoStart=true
- DataTable opérations : index, "il y a Xs", acteur+rôle, action coloré, entité, description, SoD tag
- Tag refresh counter (visible feedback)

Centralisation
- ViewPaths.CONFORMITE_LIVE_FEED + getter ViewPathsBean
- menu.xhtml : entrée Live Feed sous sous-menu Conformité (icon pi-bolt)

Tests (13/13 verts)
- couleurAction × 4 (danger/success/info/autres)
- couleurSod
- tempsRelatif × 6 (null, secondes, minutes, heures, jours, futur)
- setLimit clamp × 4
- defaults
2026-04-25 16:10:41 +00:00

63 lines
2.0 KiB
Java

package dev.lions.unionflow.client.service;
import dev.lions.unionflow.client.security.AuthHeaderFactory;
import dev.lions.unionflow.server.api.dto.audit.response.AuditTrailOperationResponse;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.MediaType;
import java.util.List;
import java.util.UUID;
import org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
/**
* Client REST de lecture audit trail (Sprint 11 ⇄ backend Sprint 10 CQRS read).
*/
@RegisterRestClient(configKey = "unionflow-api")
@RegisterClientHeaders(AuthHeaderFactory.class)
@Path("/api/audit-trail")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public interface AuditTrailRestClient {
@GET
@Path("/by-user/{userId}")
List<AuditTrailOperationResponse> parUtilisateur(
@PathParam("userId") UUID userId,
@QueryParam("from") String from,
@QueryParam("to") String to);
@GET
@Path("/by-entity/{type}/{id}")
List<AuditTrailOperationResponse> historique(
@PathParam("type") String entityType, @PathParam("id") UUID entityId);
@GET
@Path("/by-organisation/{orgId}")
List<AuditTrailOperationResponse> parOrganisation(@PathParam("orgId") UUID orgId);
@GET
@Path("/sod-violations")
List<AuditTrailOperationResponse> violationsSod();
@GET
@Path("/financial/{orgId}")
List<AuditTrailOperationResponse> operationsFinancieres(
@PathParam("orgId") UUID orgId,
@QueryParam("from") String from,
@QueryParam("to") String to);
/** Live Activity Feed (Sprint 15) — N opérations les plus récentes selon scope. */
@GET
@Path("/recent")
List<AuditTrailOperationResponse> recent(
@QueryParam("scope") String scope,
@QueryParam("orgId") UUID orgId,
@QueryParam("userId") UUID userId,
@QueryParam("limit") int limit);
}