Created
September 15, 2024 11:09
-
-
Save GoodnessEzeokafor/3b928a3f0d9fcb3894e424fec36aeb9c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { data, pagination } = | |
await this.data.transactions.findAllWithPagination( | |
{ | |
...filterQuery, | |
isRevenue: false, | |
reconTransactionType: Not(In(excludedTransactionType)), | |
}, | |
{ | |
relationFields: ['user'], | |
selectFields: this.selectFields, | |
}, | |
); | |
// in the findAllWithPagination method | |
const baseFindOptions = { | |
where: { ...query }, | |
order: { | |
createdAt: sort, | |
}, | |
take: perpage, | |
skip: page * perpage - perpage, | |
...(options?.relationFields | |
? { relations: options.relationFields } | |
: null), // lazy loading in typeORM | |
...(options?.selectFields ? { select: options.selectFields } : []), | |
...(options?.relationIds ? { loadRelationIds: true } : false), | |
// cache: true, | |
}; | |
const [data, total] = await this._entity.findAndCount(baseFindOptions); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment