adamsaghy commented on code in PR #5410:
URL: https://github.com/apache/fineract/pull/5410#discussion_r2792511023


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientsApiResource.java:
##########
@@ -168,6 +169,22 @@ public String retrieveOne(@PathParam("clientId") 
@Parameter(description = "clien
         return retrieveClient(clientId, null, staffInSelectedOfficeOnly, 
uriInfo);
     }
 
+    @GET
+    @Path("{clientId}/performance")
+    @Consumes({ MediaType.APPLICATION_JSON })
+    @Produces({ MediaType.APPLICATION_JSON })
+    @Operation(summary = "Retrieve client performance metrics", description = 
"Returns a summary of active loans and outstanding balances for a specific 
client.")
+    @ApiResponse(responseCode = "200", description = "OK", content = 
@Content(schema = @Schema(implementation = ClientPerformanceData.class)))
+    public String retrieveClientPerformance(@PathParam("clientId") 
@Parameter(description = "clientId") final Long clientId,
+            @Context final UriInfo uriInfo) {
+
+        
this.context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_RESOURCE_NAME);
+
+        final ClientPerformanceData performanceData = 
this.clientReadPlatformService.retrieveClientPerformance(clientId);
+
+        return this.toApiJsonSerializer.serialize(performanceData);

Review Comment:
   You can return directly the `ClientPerformanceData`, no need to explicitly 
convert to string.
   If you do that `@ApiResponse(responseCode = "200", description = "OK", 
content = @Content(schema = @Schema(implementation = 
ClientPerformanceData.class)))` is not needed either.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to