Change the query so we get only creation transactions.

This commit is contained in:
elweyn 2021-12-22 08:26:30 +01:00
parent c53db1e255
commit 07d4a8103a

View File

@ -9,7 +9,17 @@ export class UserTransactionRepository extends Repository<UserTransaction> {
limit: number,
offset: number,
order: Order,
onlyCreation?: boolean,
): Promise<[UserTransaction[], number]> {
if (onlyCreation) {
return this.createQueryBuilder('userTransaction')
.where('userTransaction.userId = :userId', { userId })
.andWhere('userTransaction.type = "creation"')
.orderBy('userTransaction.balanceDate', order)
.limit(limit)
.offset(offset)
.getManyAndCount()
}
return this.createQueryBuilder('userTransaction')
.where('userTransaction.userId = :userId', { userId })
.orderBy('userTransaction.balanceDate', order)