From 1458d600411b3796dd1761d50f0957953aa8c06f Mon Sep 17 00:00:00 2001 From: ilham Date: Mon, 3 Jan 2022 00:34:08 +0700 Subject: [PATCH 1/3] fix: move history user code --- src/transaction/transaction.controller.ts | 47 ++++++++++++----------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/src/transaction/transaction.controller.ts b/src/transaction/transaction.controller.ts index 2818c7a..0eeb4f5 100644 --- a/src/transaction/transaction.controller.ts +++ b/src/transaction/transaction.controller.ts @@ -125,6 +125,30 @@ export class TransactionController { }; } + @Get('history-user/:id') + async getHistoryTransactionUserByParam( + @Query('page') page: number, + @Query('pageSize') pageSize: number, + @Query('start') startDate: string, + @Query('end') endDate: string, + @Param('id', ParseUUIDPipe) id: string, + ) { + const data = await this.transactionService.transactionHistoryByUser( + page, + id, + startDate == 'null' ? null : startDate, + endDate == 'null' ? null : endDate, + pageSize, + ); + + return { + ...data, + statusCode: HttpStatus.OK, + message: 'success', + }; + } + + @Get('history-deposit') async getHistoryDepositUser( @Query('page') page: number, @@ -219,29 +243,6 @@ export class TransactionController { }; } - @Get('history-user/:id') - async getHistoryTransactionUserByParam( - @Query('page') page: number, - @Query('pageSize') pageSize: number, - @Query('start') startDate: string, - @Query('end') endDate: string, - @Param('id', ParseUUIDPipe) id: string, - ) { - const data = await this.transactionService.transactionHistoryByUser( - page, - id, - startDate == 'null' ? null : startDate, - endDate == 'null' ? null : endDate, - pageSize, - ); - - return { - ...data, - statusCode: HttpStatus.OK, - message: 'success', - }; - } - @Put('deposit-return/confirmation/:id/:status') async confirmDepositReturn( @Param('id', ParseUUIDPipe) id: string, From 9ecf5c3209e595d4a13bec20121b79e1c431a173 Mon Sep 17 00:00:00 2001 From: ilham Date: Mon, 3 Jan 2022 00:34:22 +0700 Subject: [PATCH 2/3] fix: move history user code --- src/transaction/transaction.controller.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/transaction/transaction.controller.ts b/src/transaction/transaction.controller.ts index 0eeb4f5..f7494cb 100644 --- a/src/transaction/transaction.controller.ts +++ b/src/transaction/transaction.controller.ts @@ -148,7 +148,6 @@ export class TransactionController { }; } - @Get('history-deposit') async getHistoryDepositUser( @Query('page') page: number, From 15a886eac057cb93da050ec83388491a41b7086a Mon Sep 17 00:00:00 2001 From: ilham Date: Mon, 3 Jan 2022 12:47:31 +0700 Subject: [PATCH 3/3] fix: transaction for dashboard --- src/transaction/transaction.service.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/transaction/transaction.service.ts b/src/transaction/transaction.service.ts index 62951db..f730009 100644 --- a/src/transaction/transaction.service.ts +++ b/src/transaction/transaction.service.ts @@ -1058,7 +1058,9 @@ export class TransactionService { const baseQuery = this.transactionRepository .createQueryBuilder('transactions') .innerJoin('transactions.product_price', 'product_price') - .where('transactions.type = 1 and partner_trx_id is NULL'); + .where( + 'transactions.type = 1 and partner_trx_id is NULL and transactions.status = 1', + ); const data = await baseQuery .select('SUM(transactions.amount) as total_amount') @@ -1088,7 +1090,9 @@ export class TransactionService { const baseQuery = this.transactionRepository .createQueryBuilder('transactions') .innerJoin('transactions.product_price', 'product_price') - .where('transactions.type = 1 and partner_trx_id is not NULL'); + .where( + 'transactions.type = 1 and partner_trx_id is not NULL and transactions.status = 1', + ); const data = await baseQuery .select('SUM(transactions.amount) as total_amount')