galovics commented on code in PR #3192:
URL: https://github.com/apache/fineract/pull/3192#discussion_r1206652373


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountTransactionRepository.java:
##########
@@ -53,4 +56,28 @@ List<SavingsAccountTransaction> 
findTransactionRunningBalanceBeforePivotDate(@Pa
     @Query("select sat from SavingsAccountTransaction sat where 
sat.savingsAccount.id = :savingsId and sat.dateOf <= :transactionDate and 
sat.reversed=false")
     List<SavingsAccountTransaction> 
findBySavingsAccountIdAndLessThanDateOfAndReversedIsFalse(@Param("savingsId") 
Long savingsId,
             @Param("transactionDate") LocalDate transactionDate, Pageable 
pageable);
+
+    @Query("""
+                    SELECT NEW 
org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionDTOV2(tr.id,
+                tr.typeOf, tr.dateOf, tr.amount, 
tr.releaseIdOfHoldAmountTransaction, tr.reasonForBlock,
+                tr.createdDate, tr.appUser, nt.note, tr.runningBalance, 
tr.reversed,
+                tr.reversalTransaction, tr.originalTxnId, tr.lienTransaction, 
tr.isManualTransaction,
+                fromTran, toTran, tr.savingsAccount, tr.paymentDetail, currency
+                )
+                    FROM SavingsAccountTransaction tr
+                    JOIN ApplicationCurrency currency ON (currency.code = 
tr.savingsAccount.currency.code)
+                    LEFT JOIN AccountTransferTransaction fromtran ON 
(fromtran.fromSavingsTransaction = tr)
+                    LEFT JOIN AccountTransferTransaction totran ON 
(totran.toSavingsTransaction = tr)
+                    LEFT JOIN tr.notes nt ON (nt.savingsTransaction = tr)
+                    WHERE tr.savingsAccount.id = :savingsId
+                    AND tr.savingsAccount.depositType = :depositType
+                    AND (:transactionType IS NULL OR tr.typeOf = 
:transactionType )
+                    AND (:#{#searchParameters.fromDate} IS NULL OR tr.dateOf 
>= :#{#searchParameters.fromDate} )
+                    AND (:#{#searchParameters.toDate} IS NULL OR tr.dateOf <= 
:#{#searchParameters.toDate} )
+                    AND (:#{#searchParameters.fromAmount} IS NULL OR tr.amount 
>= :#{#searchParameters.fromAmount} )
+                    AND (:#{#searchParameters.toAmount} IS NULL OR tr.amount 
<= :#{#searchParameters.toAmount} )
+            """)
+    Page<SavingsAccountTransactionDTOV2> findAll(@Param("savingsId") Long 
savingsId, @Param("depositType") Integer depositType,

Review Comment:
   Still I think this is a search use-case and should be named accordingly.
   
   A POST API is also fine with me, but if you're planning to create a new POST 
API, then please take a look at ClientSearchV2ApiResource cause it could act as 
a base pattern for the implementation.



-- 
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]

Reply via email to