vidakovic commented on code in PR #5613:
URL: https://github.com/apache/fineract/pull/5613#discussion_r2927212906
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartSlabsApiResource.java:
##########
@@ -35,118 +29,92 @@
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.MediaType;
-import jakarta.ws.rs.core.UriInfo;
import java.util.List;
+import java.util.function.Supplier;
import lombok.RequiredArgsConstructor;
-import org.apache.fineract.commands.domain.CommandWrapper;
-import org.apache.fineract.commands.service.CommandWrapperBuilder;
-import
org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
-import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
-import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
-import
org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
-import
org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
-import
org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
+import org.apache.fineract.command.core.CommandPipeline;
+import
org.apache.fineract.portfolio.interestratechart.command.InterestRateChartSlabsCreateCommand;
+import
org.apache.fineract.portfolio.interestratechart.command.InterestRateChartSlabsDeleteCommand;
+import
org.apache.fineract.portfolio.interestratechart.command.InterestRateChartSlabsUpdateCommand;
import
org.apache.fineract.portfolio.interestratechart.data.InterestRateChartSlabData;
-import
org.apache.fineract.portfolio.interestratechart.data.InterestRateChartStabRequest;
-import
org.apache.fineract.portfolio.interestratechart.service.InterestRateChartSlabReadPlatformService;
+import
org.apache.fineract.portfolio.interestratechart.data.InterestRateChartSlabsCreateRequest;
+import
org.apache.fineract.portfolio.interestratechart.data.InterestRateChartSlabsCreateResponse;
+import
org.apache.fineract.portfolio.interestratechart.data.InterestRateChartSlabsDeleteRequest;
+import
org.apache.fineract.portfolio.interestratechart.data.InterestRateChartSlabsDeleteResponse;
+import
org.apache.fineract.portfolio.interestratechart.data.InterestRateChartSlabsUpdateRequest;
+import
org.apache.fineract.portfolio.interestratechart.data.InterestRateChartSlabsUpdateResponse;
+import
org.apache.fineract.portfolio.interestratechart.service.InterestRateChartSlabsReadService;
import org.springframework.stereotype.Component;
@Path("/v1/interestratecharts/{chartId}/chartslabs")
@Component
+@Consumes({ MediaType.APPLICATION_JSON })
+@Produces({ MediaType.APPLICATION_JSON })
@Tag(name = "Interest Rate Slab (A.K.A interest bands)", description = "The
slabs a.k.a interest bands are associated with Interest Rate Chart. These bands
allow to define different interest rates for different deposit term periods.")
@RequiredArgsConstructor
public class InterestRateChartSlabsApiResource {
- private final InterestRateChartSlabReadPlatformService
interestRateChartSlabReadPlatformService;
- private final PlatformSecurityContext context;
- private final DefaultToApiJsonSerializer<InterestRateChartSlabData>
toApiJsonSerializer;
- private final PortfolioCommandSourceWritePlatformService
commandsSourceWritePlatformService;
- private final ApiRequestParameterHelper apiRequestParameterHelper;
+ private final InterestRateChartSlabsReadService
interestRateChartSlabsReadService;
+ private final CommandPipeline commandPipeline;
@GET
@Path("template")
- @Consumes({ MediaType.APPLICATION_JSON })
- @Produces({ MediaType.APPLICATION_JSON })
public InterestRateChartSlabData template(@PathParam("chartId")
@Parameter(description = "chartId") final Long chartId) {
- return
this.interestRateChartSlabReadPlatformService.retrieveTemplate();
+ return interestRateChartSlabsReadService.retrieveTemplate();
}
@GET
- @Consumes({ MediaType.APPLICATION_JSON })
- @Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Retrieve all Slabs", description = "Retrieve list of
slabs associated with a chart\n" + "\n"
+ "Example Requests:\n" + "\n" + "interestratecharts/1/chartslabs")
public List<InterestRateChartSlabData> retrieveAll(@PathParam("chartId")
@Parameter(description = "chartId") final Long chartId) {
-
-
this.context.authenticatedUser().validateHasReadPermission(INTERESTRATE_CHART_SLAB_RESOURCE_NAME);
- return
this.interestRateChartSlabReadPlatformService.retrieveAll(chartId);
+ return interestRateChartSlabsReadService.retrieveAll(chartId);
}
@GET
@Path("{chartSlabId}")
- @Consumes({ MediaType.APPLICATION_JSON })
- @Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Retrieve a Slab", description = "Retrieve a slab
associated with an Interest rate chart\n" + "\n"
+ "Example Requests:\n" + "\n" +
"interestratecharts/1/chartslabs/1\n")
public InterestRateChartSlabData retrieveOne(@PathParam("chartId")
@Parameter(description = "chartId") final Long chartId,
- @PathParam("chartSlabId") @Parameter(description = "chartSlabId")
final Long chartSlabId, @Context final UriInfo uriInfo) {
-
-
this.context.authenticatedUser().validateHasReadPermission(INTERESTRATE_CHART_SLAB_RESOURCE_NAME);
-
- InterestRateChartSlabData chartSlab =
this.interestRateChartSlabReadPlatformService.retrieveOne(chartId, chartSlabId);
- final ApiRequestJsonSerializationSettings settings =
this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
- if (settings.isTemplate()) {
- chartSlab =
this.interestRateChartSlabReadPlatformService.retrieveWithTemplate(chartSlab);
- }
-
- return chartSlab;
+ @PathParam("chartSlabId") @Parameter(description = "chartSlabId")
final Long chartSlabId) {
Review Comment:
Parameter annotation duplicate.
--
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]