add: filter deposit return
This commit is contained in:
@@ -3,7 +3,7 @@ import { DistributeTransactionDto } from './dto/distribute-transaction.dto';
|
||||
import { OrderTransactionDto } from './dto/order-transaction.dto';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Transactions } from './entities/transactions.entity';
|
||||
import { Connection, EntityNotFoundError, Repository } from 'typeorm';
|
||||
import { Between, Connection, EntityNotFoundError, Repository } from 'typeorm';
|
||||
import { COA } from './entities/coa.entity';
|
||||
import { TransactionJournal } from './entities/transaction-journal.entity';
|
||||
import { CoaService } from './coa.service';
|
||||
@@ -1001,19 +1001,30 @@ export class TransactionService {
|
||||
async getAllDepositReturnFromUser(
|
||||
user: string,
|
||||
page: number,
|
||||
startDate: string,
|
||||
endDate: string,
|
||||
pageSize?: number,
|
||||
) {
|
||||
return this.transactionRepository.findAndCount({
|
||||
const filter = {
|
||||
user: user,
|
||||
type: typeTransaction.DEPOSIT_RETURN,
|
||||
};
|
||||
|
||||
if (startDate && endDate) {
|
||||
filter['start'] = Between(new Date(startDate), new Date(endDate));
|
||||
}
|
||||
const baseQuery = this.transactionRepository.findAndCount({
|
||||
skip: page * (pageSize || 10),
|
||||
take: pageSize || 10,
|
||||
where: {
|
||||
user: user,
|
||||
type: typeTransaction.DEPOSIT_RETURN,
|
||||
},
|
||||
where: filter,
|
||||
order: {
|
||||
createdAt: 'DESC',
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
|
||||
return baseQuery;
|
||||
}
|
||||
|
||||
async getAllDepositReturnToUser(
|
||||
|
||||
Reference in New Issue
Block a user