Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ export class MonitoringBalanceRepository extends BaseRepository<MonitoringBalanc
return this.createQueryBuilder('b')
.leftJoin('b.asset', 'asset')
.select('b.created', 'timestamp')
.addSelect('b.onchainBalance', '"onchainBalance"')
.addSelect('b.lndOnchainBalance', '"lndOnchainBalance"')
.addSelect('b.lightningBalance', '"lightningBalance"')
.addSelect('b.citreaBalance', '"citreaBalance"')
.addSelect('b.customerBalance', '"customerBalance"')
.addSelect('b.onchainBalance', 'onchainBalance')
.addSelect('b.lndOnchainBalance', 'lndOnchainBalance')
.addSelect('b.lightningBalance', 'lightningBalance')
.addSelect('b.citreaBalance', 'citreaBalance')
.addSelect('b.customerBalance', 'customerBalance')
.where('asset.name = :assetName', { assetName })
.andWhere('b.created >= :fromDate', { fromDate })
.orderBy('b.created', 'ASC')
Expand All @@ -37,7 +37,7 @@ export class MonitoringBalanceRepository extends BaseRepository<MonitoringBalanc
.innerJoin(
(qb) =>
qb
.select('MAX(sub.id)', '"maxId"')
.select('MAX(sub.id)', 'maxId')
.from(MonitoringBalanceEntity, 'sub')
.leftJoin('sub.asset', 'a')
.where('a.name = :assetName', { assetName })
Expand All @@ -47,11 +47,11 @@ export class MonitoringBalanceRepository extends BaseRepository<MonitoringBalanc
'b.id = latest."maxId"',
)
.select('b.created', 'timestamp')
.addSelect('b.onchainBalance', '"onchainBalance"')
.addSelect('b.lndOnchainBalance', '"lndOnchainBalance"')
.addSelect('b.lightningBalance', '"lightningBalance"')
.addSelect('b.citreaBalance', '"citreaBalance"')
.addSelect('b.customerBalance', '"customerBalance"')
.addSelect('b.onchainBalance', 'onchainBalance')
.addSelect('b.lndOnchainBalance', 'lndOnchainBalance')
.addSelect('b.lightningBalance', 'lightningBalance')
.addSelect('b.citreaBalance', 'citreaBalance')
.addSelect('b.customerBalance', 'customerBalance')
.orderBy('b.created', 'ASC')
.setParameters({ assetName, fromDate })
.getRawMany();
Expand All @@ -64,11 +64,11 @@ export class MonitoringBalanceRepository extends BaseRepository<MonitoringBalanc
const results = await this.createQueryBuilder('b')
.leftJoin('b.asset', 'asset')
.select('b.created', 'timestamp')
.addSelect('b.onchainBalance', '"onchainBalance"')
.addSelect('b.lndOnchainBalance', '"lndOnchainBalance"')
.addSelect('b.lightningBalance', '"lightningBalance"')
.addSelect('b.citreaBalance', '"citreaBalance"')
.addSelect('b.customerBalance', '"customerBalance"')
.addSelect('b.onchainBalance', 'onchainBalance')
.addSelect('b.lndOnchainBalance', 'lndOnchainBalance')
.addSelect('b.lightningBalance', 'lightningBalance')
.addSelect('b.citreaBalance', 'citreaBalance')
.addSelect('b.customerBalance', 'customerBalance')
.where('asset.name = :assetName', { assetName })
.andWhere('b.created < :beforeDate', { beforeDate })
.orderBy('b.created', 'DESC')
Expand All @@ -83,7 +83,7 @@ export class MonitoringBalanceRepository extends BaseRepository<MonitoringBalanc
.innerJoin(
(qb) =>
qb
.select('MAX(sub.id)', '"maxId"')
.select('MAX(sub.id)', 'maxId')
.from(MonitoringBalanceEntity, 'sub')
.groupBy('sub."assetId"'),
'latest',
Expand All @@ -104,7 +104,7 @@ export class MonitoringBalanceRepository extends BaseRepository<MonitoringBalanc

private async maxEntity(assetId: number): Promise<MonitoringBalanceEntity | null> {
const maxId = await this.createQueryBuilder()
.select('max(id) as "maxId"')
.select('max(id)', 'maxId')
.where('"assetId" = :assetId', { assetId })
.getRawOne<{ maxId: number }>();
if (!maxId) return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export class MonitoringEvmBalanceRepository extends BaseRepository<MonitoringEvm
return this.createQueryBuilder('b')
.select('b.created', 'timestamp')
.addSelect('b.blockchain', 'blockchain')
.addSelect('b.nativeBalance', '"nativeBalance"')
.addSelect('b.tokenBalances', '"tokenBalances"')
.addSelect('b.nativeBalance', 'nativeBalance')
.addSelect('b.tokenBalances', 'tokenBalances')
.where('b.created >= :fromDate', { fromDate })
.orderBy('b.created', 'ASC')
.getRawMany();
Expand All @@ -33,7 +33,7 @@ export class MonitoringEvmBalanceRepository extends BaseRepository<MonitoringEvm
.innerJoin(
(qb) =>
qb
.select('MAX(sub.id)', '"maxId"')
.select('MAX(sub.id)', 'maxId')
.from(MonitoringEvmBalanceEntity, 'sub')
.where('sub.created >= :fromDate', { fromDate })
.groupBy(`sub.blockchain, TO_CHAR(sub.created, '${format}')`),
Expand All @@ -42,8 +42,8 @@ export class MonitoringEvmBalanceRepository extends BaseRepository<MonitoringEvm
)
.select('b.created', 'timestamp')
.addSelect('b.blockchain', 'blockchain')
.addSelect('b.nativeBalance', '"nativeBalance"')
.addSelect('b.tokenBalances', '"tokenBalances"')
.addSelect('b.nativeBalance', 'nativeBalance')
.addSelect('b.tokenBalances', 'tokenBalances')
.orderBy('b.created', 'ASC')
.setParameters({ fromDate })
.getRawMany();
Expand All @@ -56,7 +56,7 @@ export class MonitoringEvmBalanceRepository extends BaseRepository<MonitoringEvm
.innerJoin(
(qb) =>
qb
.select('MAX(sub.id)', '"maxId"')
.select('MAX(sub.id)', 'maxId')
.from(MonitoringEvmBalanceEntity, 'sub')
.where('sub.created < :beforeDate', { beforeDate })
.groupBy('sub.blockchain'),
Expand All @@ -65,8 +65,8 @@ export class MonitoringEvmBalanceRepository extends BaseRepository<MonitoringEvm
)
.select('b.created', 'timestamp')
.addSelect('b.blockchain', 'blockchain')
.addSelect('b.nativeBalance', '"nativeBalance"')
.addSelect('b.tokenBalances', '"tokenBalances"')
.addSelect('b.nativeBalance', 'nativeBalance')
.addSelect('b.tokenBalances', 'tokenBalances')
.setParameters({ beforeDate })
.getRawMany();
}
Expand All @@ -76,7 +76,7 @@ export class MonitoringEvmBalanceRepository extends BaseRepository<MonitoringEvm
.innerJoin(
(qb) =>
qb
.select('MAX(sub.id)', '"maxId"')
.select('MAX(sub.id)', 'maxId')
.from(MonitoringEvmBalanceEntity, 'sub')
.groupBy('sub.blockchain'),
'latest',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class LightningWalletRepository extends BaseRepository<LightningWalletEnt

return this.createQueryBuilder()
.select('"assetId"')
.addSelect('SUM(balance)', '"totalBalance"')
.addSelect('SUM(balance)', 'totalBalance')
.where('"lnbitsWalletId" IN (:...internalLnbitsWalletIds)', { internalLnbitsWalletIds })
.groupBy('"assetId"')
.getRawMany<LightningWalletTotalBalanceDto>();
Expand All @@ -31,7 +31,7 @@ export class LightningWalletRepository extends BaseRepository<LightningWalletEnt
async getCustomerBalances(excludeLnbitsWalletIds: string[]): Promise<LightningWalletTotalBalanceDto[]> {
const query = this.createQueryBuilder()
.select('"assetId"')
.addSelect('SUM(balance)', '"totalBalance"')
.addSelect('SUM(balance)', 'totalBalance')
.groupBy('"assetId"');

if (excludeLnbitsWalletIds.length) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class UserTransactionRepository extends BaseRepository<UserTransactionEnt

async getMaxCreationTimestamp(lnbitsWalletId: string): Promise<{ maxCreationTimestamp: Date } | undefined> {
return this.createQueryBuilder('ut')
.select('max(ut.creationTimestamp) as "maxCreationTimestamp"')
.select('max(ut.creationTimestamp)', 'maxCreationTimestamp')
.leftJoin('ut.lightningWallet', 'lw')
.where('lw.lnbitsWalletId = :lnbitsWalletId', { lnbitsWalletId })
.groupBy('lw.lnbitsWalletId')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class UserBoltcardService {
} else {
const lightningWalletIterator = this.lightningWalletRepository.getRawIterator<{ adminKey: string }>(
100,
'adminKey',
'"adminKey"',
);
let lightningWalletInfo = await lightningWalletIterator.next();

Expand Down
Loading