Mk9894 commented on code in PR #3192:
URL: https://github.com/apache/fineract/pull/3192#discussion_r1206563735
##########
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:
@galovics As per my current implementation findAll will also work. If you
dont provide any query param to this endpoint, still you can get all the
transactions without any filter applied to the result set! By adding query
params you can get the filtered records.
If i misunderstood the requirement, then Is it okay to implement a POST
endpoint for this ?
Eg: POST /savingsaccount/{id}/transactions/search
Please confirm.
--
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]