adamsaghy commented on code in PR #4638:
URL: https://github.com/apache/fineract/pull/4638#discussion_r2076280033
##########
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:
I dont think you are missing anything, except these separation is not
provided at any layer. Entities are used in services not only in repositories.
DTOs are (re)used everywhere....
I reckon the idea was to do 1 step closer to the ideal solution:
leave the JsonCommand, JsonElement behind and work with DTOs...even if they
are shared between the layers... I guess we can consider one additional step
here...
Lets focus on the API - Service layer for now:
Regarding communication from API to Service layer, what are your
recommendations?
My 2 cents if we are considering to have DTO separation between these
layers, first we should move validations and some of the data transformation
(resolving enums, etc) from service layer into the API layer to have real
difference between the incoming request (DTO #1) into the API layer and the
incoming request (DTO #2) into service layer.
@galovics @vidakovic what do you think?
--
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]