galovics commented on code in PR #4638:
URL: https://github.com/apache/fineract/pull/4638#discussion_r2077117819
##########
fineract-core/src/main/java/org/apache/fineract/infrastructure/event/external/service/ExternalEventConfigurationWritePlatformServiceImpl.java:
##########
@@ -22,31 +22,28 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import lombok.AllArgsConstructor;
-import org.apache.fineract.infrastructure.core.api.JsonCommand;
-import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
-import
org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
-import
org.apache.fineract.infrastructure.event.external.command.ExternalEventConfigurationCommand;
+import lombok.RequiredArgsConstructor;
+import org.apache.fineract.command.core.Command;
+import
org.apache.fineract.infrastructure.event.external.data.ExternalEventConfigKey;
+import
org.apache.fineract.infrastructure.event.external.data.ExternalEventConfigurationRequest;
+import
org.apache.fineract.infrastructure.event.external.data.ExternalEventConfigurationResponse;
import
org.apache.fineract.infrastructure.event.external.repository.ExternalEventConfigurationRepository;
import
org.apache.fineract.infrastructure.event.external.repository.domain.ExternalEventConfiguration;
-import
org.apache.fineract.infrastructure.event.external.serialization.ExternalEventConfigurationCommandFromApiJsonDeserializer;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
-@AllArgsConstructor
+@RequiredArgsConstructor
public class ExternalEventConfigurationWritePlatformServiceImpl implements
ExternalEventConfigurationWritePlatformService {
private final ExternalEventConfigurationRepository repository;
- private final ExternalEventConfigurationCommandFromApiJsonDeserializer
fromApiJsonDeserializer;
@Transactional
@Override
- public CommandProcessingResult updateConfigurations(final JsonCommand
command) {
- final ExternalEventConfigurationCommand configurationCommand =
fromApiJsonDeserializer.commandFromApiJson(command.json());
- final Map<String, Boolean> commandConfigurations =
configurationCommand.externalEventConfigurations();
- final Map<String, Object> changes = new HashMap<>();
+ public ExternalEventConfigurationResponse
updateConfigurations(Command<ExternalEventConfigurationRequest> command) {
Review Comment:
@adamsaghy Yep. The most pressing issue even with this new solution is that
the API level things are sinking into the service layer.
Let's have separate DTOs, Mapstruct mappers in place so we can separate
these.
Considering the validation logic, definitely. Plus there should be
multi-level validations as well:
- One validator on the API layer which purely checks whether an API request
is valid (like an attribute has positive numbers, notnull, etc)
- One validator on the service layer which checks against business logic
(like a cumulative loan shouldn't have XYZ set as well)
These 2 validations are 100% mixed together as of today but they should be
separated.
--
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]