diff --git a/src/subdomains/core/buy-crypto/routes/buy/buy.service.ts b/src/subdomains/core/buy-crypto/routes/buy/buy.service.ts index ac3cd4d617..6ea5f9fae3 100644 --- a/src/subdomains/core/buy-crypto/routes/buy/buy.service.ts +++ b/src/subdomains/core/buy-crypto/routes/buy/buy.service.ts @@ -80,7 +80,7 @@ export class BuyService { const { user } = await this.buyRepo.findOne({ where: { id: buyId }, relations: { user: true }, - select: ['id', 'user'], + select: { id: true, user: true }, }); const userVolume = await this.getUserVolume(user.id); diff --git a/src/subdomains/core/buy-crypto/routes/swap/swap.service.ts b/src/subdomains/core/buy-crypto/routes/swap/swap.service.ts index bf66c89ea0..b8b32967b9 100644 --- a/src/subdomains/core/buy-crypto/routes/swap/swap.service.ts +++ b/src/subdomains/core/buy-crypto/routes/swap/swap.service.ts @@ -106,7 +106,7 @@ export class SwapService { const { user } = await this.swapRepo.findOne({ where: { id: swapId }, relations: { user: true }, - select: ['id', 'user'], + select: { id: true, user: true }, }); const userVolume = await this.getUserVolume(user.id); diff --git a/src/subdomains/core/sell-crypto/route/sell.service.ts b/src/subdomains/core/sell-crypto/route/sell.service.ts index 4372443e26..082ae23695 100644 --- a/src/subdomains/core/sell-crypto/route/sell.service.ts +++ b/src/subdomains/core/sell-crypto/route/sell.service.ts @@ -240,7 +240,7 @@ export class SellService { const { user } = await this.sellRepo.findOne({ where: { id: sellId }, relations: { user: true }, - select: ['id', 'user'], + select: { id: true, user: true }, }); const userVolume = await this.getUserVolume(user.id); diff --git a/src/subdomains/generic/user/models/user-data/user-data.service.ts b/src/subdomains/generic/user/models/user-data/user-data.service.ts index 7d73b134be..4a9a10bd9c 100644 --- a/src/subdomains/generic/user/models/user-data/user-data.service.ts +++ b/src/subdomains/generic/user/models/user-data/user-data.service.ts @@ -46,7 +46,7 @@ import { MailContext } from 'src/subdomains/supporting/notification/enums'; import { SpecialExternalAccountService } from 'src/subdomains/supporting/payment/services/special-external-account.service'; import { TransactionService } from 'src/subdomains/supporting/payment/services/transaction.service'; import { transliterate } from 'transliteration'; -import { Equal, FindOptionsRelations, In, IsNull, Not } from 'typeorm'; +import { Equal, FindOptionsRelations, In, IsNull, MoreThan, Not } from 'typeorm'; import { WebhookService } from '../../services/webhook/webhook.service'; import { MergeReason } from '../account-merge/account-merge.entity'; import { AccountMergeService } from '../account-merge/account-merge.service'; @@ -219,12 +219,11 @@ export class UserDataService { } async getUserDatasWithKycFile(): Promise { - return this.userDataRepo - .createQueryBuilder('userData') - .select(['userData.id', 'userData.kycFileId', 'userData.amlAccountType', 'userData.verifiedName']) - .where('userData.kycFileId > 0') - .orderBy('userData.kycFileId', 'ASC') - .getMany(); + return this.userDataRepo.find({ + select: { id: true, kycFileId: true, amlAccountType: true, verifiedName: true }, + where: { kycFileId: MoreThan(0) }, + order: { kycFileId: 'ASC' }, + }); } async getUserDataByKey(key: string, value: any): Promise { @@ -1124,7 +1123,7 @@ export class UserDataService { private async updateBankTxTime(userDataId: number): Promise { const txList = await this.repos.bankTx.find({ - select: ['id'], + select: { id: true }, where: [ { buyCrypto: { buy: { user: { userData: { id: userDataId } } } } }, { buyFiats: { sell: { user: { userData: { id: userDataId } } } } }, diff --git a/src/subdomains/generic/user/models/user/user.repository.ts b/src/subdomains/generic/user/models/user/user.repository.ts index 732a75762b..f97896ec9e 100644 --- a/src/subdomains/generic/user/models/user/user.repository.ts +++ b/src/subdomains/generic/user/models/user/user.repository.ts @@ -27,7 +27,7 @@ export class UserRepository extends BaseRepository { private async getNextRef(): Promise { // get highest numerical ref const nextRef = await this.findOne({ - select: ['id', 'ref'], + select: { id: true, ref: true }, where: { ref: Like('%[0-9]-[0-9]%') }, order: { ref: 'DESC' }, }).then((u) => +u.ref.replace('-', '') + 1); diff --git a/src/subdomains/generic/user/models/user/user.service.ts b/src/subdomains/generic/user/models/user/user.service.ts index c848b77a2e..e92432e3ea 100644 --- a/src/subdomains/generic/user/models/user/user.service.ts +++ b/src/subdomains/generic/user/models/user/user.service.ts @@ -453,7 +453,7 @@ export class UserService { const { userData } = await this.userRepo.findOne({ where: { id: userId }, relations: { userData: true }, - select: ['id', 'userData'], + select: { id: true, userData: true }, }); await this.userDataService.updateVolumes(userData.id); } diff --git a/src/subdomains/supporting/dex/services/dex.service.ts b/src/subdomains/supporting/dex/services/dex.service.ts index 392780bbf8..f67870718e 100644 --- a/src/subdomains/supporting/dex/services/dex.service.ts +++ b/src/subdomains/supporting/dex/services/dex.service.ts @@ -222,7 +222,10 @@ export class DexService { } async getPendingOrders(context: LiquidityOrderContext): Promise { - const pending = await this.liquidityOrderRepo.find({ where: { context }, select: ['context', 'correlationId'] }); + const pending = await this.liquidityOrderRepo.find({ + where: { context }, + select: { context: true, correlationId: true }, + }); return pending.map((o) => o.correlationId); } diff --git a/src/subdomains/supporting/payin/strategies/register/impl/base/citrea.strategy.ts b/src/subdomains/supporting/payin/strategies/register/impl/base/citrea.strategy.ts index 83f0743c58..493a47348c 100644 --- a/src/subdomains/supporting/payin/strategies/register/impl/base/citrea.strategy.ts +++ b/src/subdomains/supporting/payin/strategies/register/impl/base/citrea.strategy.ts @@ -71,7 +71,7 @@ export abstract class CitreaBaseStrategy extends RegisterStrategy { private async getLastCheckedBlockHeight(depositAddress: BlockchainAddress): Promise { return this.payInRepository .findOne({ - select: ['id', 'blockHeight'], + select: { id: true, blockHeight: true }, where: { address: depositAddress }, order: { blockHeight: 'DESC' }, loadEagerRelations: false, diff --git a/src/subdomains/supporting/payin/strategies/register/impl/cardano.strategy.ts b/src/subdomains/supporting/payin/strategies/register/impl/cardano.strategy.ts index 9b036e1415..369b2a24c7 100644 --- a/src/subdomains/supporting/payin/strategies/register/impl/cardano.strategy.ts +++ b/src/subdomains/supporting/payin/strategies/register/impl/cardano.strategy.ts @@ -70,7 +70,7 @@ export class CardanoStrategy extends RegisterStrategy { private async getLastCheckedBlockHeight(depositAddress: BlockchainAddress): Promise { return this.payInRepository .findOne({ - select: ['id', 'blockHeight'], + select: { id: true, blockHeight: true }, where: { address: depositAddress }, order: { blockHeight: 'DESC' }, loadEagerRelations: false, diff --git a/src/subdomains/supporting/payin/strategies/register/impl/monero.strategy.ts b/src/subdomains/supporting/payin/strategies/register/impl/monero.strategy.ts index a2cd2ef83c..2d1f75e0bd 100644 --- a/src/subdomains/supporting/payin/strategies/register/impl/monero.strategy.ts +++ b/src/subdomains/supporting/payin/strategies/register/impl/monero.strategy.ts @@ -53,7 +53,7 @@ export class MoneroStrategy extends PollingStrategy { private async getLastCheckedBlockHeight(): Promise { return this.payInRepository .findOne({ - select: ['id', 'blockHeight'], + select: { id: true, blockHeight: true }, where: { address: { blockchain: this.blockchain } }, order: { blockHeight: 'DESC' }, loadEagerRelations: false, diff --git a/src/subdomains/supporting/payin/strategies/register/impl/zano.strategy.ts b/src/subdomains/supporting/payin/strategies/register/impl/zano.strategy.ts index 87d799ab4d..e04d26326a 100644 --- a/src/subdomains/supporting/payin/strategies/register/impl/zano.strategy.ts +++ b/src/subdomains/supporting/payin/strategies/register/impl/zano.strategy.ts @@ -55,7 +55,7 @@ export class ZanoStrategy extends PollingStrategy { private async getLastCheckedBlockHeight(): Promise { return this.payInRepository .findOne({ - select: ['id', 'blockHeight'], + select: { id: true, blockHeight: true }, where: { address: { blockchain: this.blockchain } }, order: { blockHeight: 'DESC' }, loadEagerRelations: false,