22
33import io .quarkus .security .identity .SecurityIdentity ;
44import jakarta .inject .Inject ;
5- import jakarta .validation .Validator ;
65import jakarta .ws .rs .*;
76import jakarta .ws .rs .core .*;
87
2120@ Path ("/api" )
2221public class AccountResource {
2322
24- @ Inject
25- Validator validator ;
26-
2723 @ Inject
2824 AccountHooks accountHooks ;
2925
3026 @ POST
3127 @ Consumes (MediaType .APPLICATION_JSON )
28+ @ Produces (MediaType .APPLICATION_JSON )
3229 @ Path ("/account-hooks" )
3330 public Response accountHooks (@ Context SecurityIdentity identity ,
3431 AccountHookRequest request ) {
@@ -51,13 +48,16 @@ public Response accountHooks(@Context SecurityIdentity identity,
5148
5249 // Run each action's function and determine whether successful
5350 Map <String , Boolean > hookResults = hooks .stream ()
54- .collect (Collectors .toMap (s -> s .toString (), s -> {
51+ .collect (Collectors .toMap (s -> s .getLabel (), s -> {
5552 Predicate <String > fn = hooksMap .get (s );
5653 return fn .test (userId );
5754 }));
5855
59- AccountHookResponse responseBody = new AccountHookResponse (true ,
60- hookResults );
56+ Boolean allHooksSuccess = hookResults .values ().stream ()
57+ .allMatch (Boolean ::booleanValue );
58+
59+ AccountHookResponse responseBody = new AccountHookResponse (
60+ allHooksSuccess , hookResults );
6161
6262 return Response .ok (responseBody ).build ();
6363 }
0 commit comments