Withdrew table name from query builder.

This commit is contained in:
Hannes Heine 2021-11-24 14:29:07 +01:00 committed by ogerly
parent 9193eeb6a8
commit 3ec7960865

View File

@ -49,7 +49,7 @@ async function getUserCreations(id: number): Promise<number[]> {
// targetDate: Raw((alias) => `${alias} > :date`, { date: "2021-09-01" /* TODO: NOW().format("YYYY-MM") + '-01' - 2 Month */ }),
// })
const createdAmountBeforeLastMonth = await getCustomRepository(TransactionCreationRepository)
.createQueryBuilder('transaction_creations')
.createQueryBuilder()
.select('SUM(transaction_creations.amount)', 'sum')
.where('transaction_creations.state_user_id = :id', { id })
.andWhere({
@ -57,7 +57,7 @@ async function getUserCreations(id: number): Promise<number[]> {
})
.getRawOne()
console.log('createdAmountBeforeLastMonth', createdAmountBeforeLastMonth)
const createdAmountLastMonth = await getCustomRepository(TransactionCreationRepository)
.createQueryBuilder('transaction_creations')
.select('SUM(transaction_creations.amount)', 'sum')