vidakovic commented on code in PR #6015:
URL: https://github.com/apache/fineract/pull/6015#discussion_r3538050165
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupsApiResource.java:
##########
@@ -357,31 +365,24 @@ public String unassignLoanOfficer(@PathParam("groupId")
@Parameter(description =
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Update a Group", operationId = "updateGroup",
description = "Updates a Group")
- @RequestBody(required = true, content = @Content(schema =
@Schema(implementation =
GroupsApiResourceSwagger.PutGroupsGroupIdRequest.class)))
- @ApiResponse(responseCode = "200", description = "OK", content =
@Content(schema = @Schema(implementation =
GroupsApiResourceSwagger.PutGroupsGroupIdResponse.class)))
- public String update(@PathParam("groupId") @Parameter(description =
"groupId") final Long groupId,
- @Parameter(hidden = true) final String apiRequestBodyAsJson) {
-
- final CommandWrapper commandRequest = new CommandWrapperBuilder() //
- .updateGroup(groupId) //
- .withJson(apiRequestBodyAsJson) //
- .build(); //
- final CommandProcessingResult result =
commandsSourceWritePlatformService.logCommandSource(commandRequest);
- return toApiJsonSerializer.serialize(result);
+ @ApiResponse(responseCode = "200", description = "OK")
+ public GroupUpdateResponse update(@PathParam("groupId") final Long
groupId, GroupUpdateRequest request) {
+ request.setGroupId(groupId);
+ var command = new GroupUpdateCommand();
+ command.setPayload(request);
+ return dispatcher.<GroupUpdateRequest,
GroupUpdateResponse>dispatch(command).get();
}
@DELETE
@Path("{groupId}")
@Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Delete a Group", operationId = "deleteGroup",
description = "A group can be deleted if it is in pending state and has no
associations - clients, loans or savings")
- @ApiResponse(responseCode = "200", description = "OK", content =
@Content(schema = @Schema(implementation =
GroupsApiResourceSwagger.DeleteGroupsGroupIdResponse.class)))
- public String delete(@PathParam("groupId") @Parameter(description =
"groupId") final Long groupId) {
-
- final CommandWrapper commandRequest = new CommandWrapperBuilder() //
- .deleteGroup(groupId) //
- .build(); //
- final CommandProcessingResult result =
commandsSourceWritePlatformService.logCommandSource(commandRequest);
- return toApiJsonSerializer.serialize(result);
+ @ApiResponse(responseCode = "200", description = "OK")
Review Comment:
HTTP 200 is the obvious and trivial default state here. No need to document
the obvious (I know that we did in the past). Less boilerplate, less strain on
the eyes.
--
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]