kapil-panchal commented on PR #4902:
URL: https://github.com/apache/fineract/pull/4902#issuecomment-3184243393
> @@ -66,4 +63,17 @@ public ApplicationCurrency
findOneWithNotFoundDetection(final String currencyCod
}
return applicationCurrency;
}
+
+ public Boolean existsByCode(String code) {
+ return repository.existsByCode(code);
+ }
+
+ public ApplicationCurrency save(ApplicationCurrency currency) {
+ if (existsByCode(currency.getCode())) {
you can do it, but pretty unnecessary... however this API will not be under
heavy load ever, so it does not have performance impact. also sql
exceptions can be wrapped into any "new" exception also... but like i
said... it could be fine as this will be used rarely
"nameCode sounds to be a dynamically generated value. Have it as and dont
modify incoming request and so... once you reach the point you want to
store in db, calculate and store if it is used for anything..." I think I
agree with this approach.
On Wed, Aug 13, 2025 at 8:15 PM Adam Saghy ***@***.***> wrote:
> ***@***.**** commented on this pull request.
> ------------------------------
>
> In
>
fineract-core/src/main/java/org/apache/fineract/organisation/monetary/domain/ApplicationCurrencyRepositoryWrapper.java
> <https://github.com/apache/fineract/pull/4902#discussion_r2273701390>:
>
> > @@ -66,4 +63,17 @@ public ApplicationCurrency
findOneWithNotFoundDetection(final String currencyCod
> }
> return applicationCurrency;
> }
> +
> + public Boolean existsByCode(String code) {
> + return repository.existsByCode(code);
> + }
> +
> + public ApplicationCurrency save(ApplicationCurrency currency) {
> + if (existsByCode(currency.getCode())) {
>
> you can do it, but pretty unnecessary... however this API will not be
> under heavy load ever, so it does not have performance impact. also sql
> exceptions can be wrapped into any "new" exception also... but like i
> said... it could be fine as this will be used rarely
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/apache/fineract/pull/4902#discussion_r2273701390>, or
> unsubscribe
>
<https://github.com/notifications/unsubscribe-auth/ATFEJGCXMV5ADGBR2FYCRCL3NNFPZAVCNFSM6AAAAACCTG6XLWVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTCMJWGM3TKMJTHE>
> .
> You are receiving this because you modified the open/close state.Message
> ID: ***@***.***>
>
--
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]