-
Notifications
You must be signed in to change notification settings - Fork 2.2k
FINERACT-2253: New command processing - Account (org.apache.fineract.portfolio.account) #5126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
kapilpanchal123
wants to merge
1
commit into
apache:develop
Choose a base branch
from
kapilpanchal123:prototype-FINERACT-2253-v2
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,095
−0
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...in/java/org/apache/fineract/portfolio/account/command/AccountRefundByTransferCommand.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /** | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.fineract.portfolio.account.command; | ||
|
|
||
| import java.io.Serial; | ||
| import lombok.Getter; | ||
| import lombok.Setter; | ||
| import org.apache.fineract.command.core.Command; | ||
| import org.apache.fineract.portfolio.account.data.RefundByTransferRequest; | ||
|
|
||
| @Getter | ||
| @Setter | ||
| public class AccountRefundByTransferCommand extends Command<RefundByTransferRequest> { | ||
|
|
||
| @Serial | ||
| private static final long serialVersionUID = 1L; | ||
| } |
33 changes: 33 additions & 0 deletions
33
...main/java/org/apache/fineract/portfolio/account/command/AccountTransferCreateCommand.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /** | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.fineract.portfolio.account.command; | ||
|
|
||
| import java.io.Serial; | ||
| import lombok.Getter; | ||
| import lombok.Setter; | ||
| import org.apache.fineract.command.core.Command; | ||
| import org.apache.fineract.portfolio.account.data.AccountTransferRequest; | ||
|
|
||
| @Getter | ||
| @Setter | ||
| public class AccountTransferCreateCommand extends Command<AccountTransferRequest> { | ||
|
|
||
| @Serial | ||
| private static final long serialVersionUID = 1L; | ||
| } |
33 changes: 33 additions & 0 deletions
33
.../java/org/apache/fineract/portfolio/account/command/StandingInstructionCreateCommand.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /** | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.fineract.portfolio.account.command; | ||
|
|
||
| import java.io.Serial; | ||
| import lombok.Getter; | ||
| import lombok.Setter; | ||
| import org.apache.fineract.command.core.Command; | ||
| import org.apache.fineract.portfolio.account.data.StandingInstructionCreateRequest; | ||
|
|
||
| @Getter | ||
| @Setter | ||
| public class StandingInstructionCreateCommand extends Command<StandingInstructionCreateRequest> { | ||
|
|
||
| @Serial | ||
| private static final long serialVersionUID = 1L; | ||
| } |
15 changes: 15 additions & 0 deletions
15
.../java/org/apache/fineract/portfolio/account/command/StandingInstructionUpdateCommand.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package org.apache.fineract.portfolio.account.command; | ||
|
|
||
| import java.io.Serial; | ||
| import lombok.Getter; | ||
| import lombok.Setter; | ||
| import org.apache.fineract.command.core.Command; | ||
| import org.apache.fineract.portfolio.account.data.StandingInstructionUpdateRequest; | ||
|
|
||
| @Getter | ||
| @Setter | ||
| public class StandingInstructionUpdateCommand extends Command<StandingInstructionUpdateRequest> { | ||
|
|
||
| @Serial | ||
| private static final long serialVersionUID = 1L; | ||
| } |
79 changes: 79 additions & 0 deletions
79
...core/src/main/java/org/apache/fineract/portfolio/account/data/AccountTransferRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| /** | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.fineract.portfolio.account.data; | ||
|
|
||
| import jakarta.validation.constraints.NotBlank; | ||
| import jakarta.validation.constraints.Size; | ||
| import java.io.Serial; | ||
| import java.io.Serializable; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
| import lombok.Setter; | ||
| import org.apache.fineract.validation.constraints.Locale; | ||
|
|
||
| @Getter | ||
| @Setter | ||
| @NoArgsConstructor | ||
| public class AccountTransferRequest implements Serializable { | ||
|
|
||
| @Serial | ||
| private static final long serialVersionUID = 1L; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.transfer.description.not.blank}") | ||
| @Size(max = 200, message = "{org.apache.fineract.portfolio.account.data.transfer.description.size}") | ||
| private String transferDescription; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.to.office.id.not.blank}") | ||
| private String toOfficeId; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.to.account.type.not.blank}") | ||
| private String toAccountType; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.date.format.not.blank}") | ||
| private String dateFormat; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.transfer.amount.not.blank}") | ||
| private String transferAmount; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.to.account.id.not.blank}") | ||
| private String toAccountId; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.from.client.id.not.blank}") | ||
| private String fromClientId; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.locale.not.blank}") | ||
| @Size(max = 50, message = "{org.apache.fineract.portfolio.account.data.locale.size}") | ||
| @Locale | ||
| private String locale; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.transfer.date.not.blank}") | ||
| private String transferDate; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.from.account.type.not.blank}") | ||
| private String fromAccountType; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.to.client.id.not.blank}") | ||
| private String toClientId; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.from.account.id.not.blank}") | ||
| private String fromAccountId; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.from.office.id.not.blank}") | ||
| private String fromOfficeId; | ||
| } | ||
42 changes: 42 additions & 0 deletions
42
...ore/src/main/java/org/apache/fineract/portfolio/account/data/AccountTransferResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /** | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.fineract.portfolio.account.data; | ||
|
|
||
| import java.io.Serial; | ||
| import java.io.Serializable; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
| import lombok.Setter; | ||
|
|
||
| @Getter | ||
| @Setter | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
| @Builder | ||
| public class AccountTransferResponse implements Serializable { | ||
|
|
||
| @Serial | ||
| private static final long serialVersionUID = 1L; | ||
|
|
||
| private Long savingsId; | ||
| private Long loanId; | ||
| private Long resourceId; | ||
| } |
73 changes: 73 additions & 0 deletions
73
...ore/src/main/java/org/apache/fineract/portfolio/account/data/RefundByTransferRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| /** | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.fineract.portfolio.account.data; | ||
|
|
||
| import jakarta.validation.constraints.NotBlank; | ||
| import jakarta.validation.constraints.Size; | ||
| import java.io.Serial; | ||
| import java.io.Serializable; | ||
| import org.apache.fineract.validation.constraints.Locale; | ||
|
|
||
| public class RefundByTransferRequest implements Serializable { | ||
|
|
||
| @Serial | ||
| private static final long serialVersionUID = 1L; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.transfer.description.not.blank}") | ||
| @Size(max = 200, message = "{org.apache.fineract.portfolio.account.data.transfer.description.size}") | ||
| private String transferDescription; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.to.office.id.not.blank}") | ||
| private String toOfficeId; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.to.account.type.not.blank}") | ||
| private String toAccountType; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.date.format.not.blank}") | ||
| private String dateFormat; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.transfer.amount.not.blank}") | ||
| private String transferAmount; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.to.account.id.not.blank}") | ||
| private String toAccountId; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.from.client.id.not.blank}") | ||
| private String fromClientId; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.locale.not.blank}") | ||
| @Size(max = 50, message = "{org.apache.fineract.portfolio.account.data.locale.size}") | ||
| @Locale | ||
| private String locale; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.transfer.date.not.blank}") | ||
| private String transferDate; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.from.account.type.not.blank}") | ||
| private String fromAccountType; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.to.client.id.not.blank}") | ||
| private String toClientId; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.from.account.id.not.blank}") | ||
| private String fromAccountId; | ||
|
|
||
| @NotBlank(message = "{org.apache.fineract.portfolio.account.data.from.office.id.not.blank}") | ||
| private String fromOfficeId; | ||
| } |
39 changes: 39 additions & 0 deletions
39
...re/src/main/java/org/apache/fineract/portfolio/account/data/RefundByTransferResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /** | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.fineract.portfolio.account.data; | ||
|
|
||
| import java.io.Serial; | ||
| import java.io.Serializable; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
| import lombok.Setter; | ||
|
|
||
| @Getter | ||
| @Setter | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
| public class RefundByTransferResponse implements Serializable { | ||
|
|
||
| @Serial | ||
| private static final long serialVersionUID = 1L; | ||
|
|
||
| private Long savingsId; | ||
| private Long resourceId; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use
@LocalDate(dateField = "transferDate", formatField = "dateFormat", localeField = "locale")to validate the incoming dateThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is happening is that in the service logic the date formatter is recomputed and the passed as a parameter. e.g. public class AccountTransfersWritePlatformServiceImpl the formatter is recomputed "final LocalDate transactionDate = command.localDateValueOfParameterNamed(transferDateParamName);
final BigDecimal transactionAmount = command.bigDecimalValueOfParameterNamed(transferAmountParamName);
" if we standardize the above then this calculation need not be done (as parameter final SavingsAccountTransaction withdrawal = this.savingsAccountDomainService.handleWithdrawal(fromSavingsAccount, fmt,
transactionDate, transactionAmount, paymentDetail, transactionBooleanValues, backdatedTxnsAllowedTill);) there are other methods also?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this request dto is for API layer (incoming request via API call) or is this DTO for service layer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The NewCommandProcessingInfrastructure is harmonizing the flow of request objects from API->Service->Repository and back as response objects, this DTO will take care of all of the above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The entity will be a separate decoupling object which will be mapped via mapstruct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is where the importance of typesafety comes in, as we are not dealing with JsonStrings which are then parsed and validated at a later stage. The request and response objects the filtering is happening right before the API logic is executed. Jakarta validation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kapilpanchal123 Can you stop replying nonsense, AI generated BS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice :).
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not nice....
I think this is where the importance of typesafety comes in, as we are not dealing with JsonStrings which are then parsed and validated at a later stage. The request and response objects the filtering is happening right before the API logic is executed. Jakarta validation.-> Not one of these sentences has any meaning...I have asked you to take a look at
BusinessDateUpdateRequestandBusinessDateDTOwhere you will see why (correctly) the two DTOs are different! They have different purposes and different annotations.BusinessDateDTOis used at service layer, all fields are using the relevant internal types (type isBusinessDateType). No Bean validation on it. No@JsonLocalDateArrayFormatto format theLocalDatefield before serialization. (used inBusinessDateUpdateResponse)BusinessDateUpdateRequestis used at API layer, all fields are using simple data type (like String), includingdateandtype. Bean Validation are enforced on this DTO and its values (see number of Bean validation annotations).There are number of difference between the DTOs: data types, fields and annotations wise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the disjoint was in this Data Architecture, my earlier statement DTO -> Mapper -> Entity should be Data -> Mapper -> Service Objects -> Mapper -> Entity.
[ Client JSON Request ]
↓
(DTO Layer)
──────────────────────
LoanProductRequestDTO
↓
(Mapper / Converter Layer)
──────────────────────
EnumOptionData, Enumerations, Mappers, Assemblers
↓
(Entity / Domain Layer)
──────────────────────
LoanProduct, Client, Account
↓
(Repository / Persistence)
I used to think that the DTO is directly mapped to the Entity using a Mapper like mapstruct. But we are using a lot of enums in the application, so there has to be decoupling between the client facing DTO's, Service layer objects and then the entity or repository layer objects?