diff --git a/src/transaction/transaction.controller.ts b/src/transaction/transaction.controller.ts index 7cdb715..b8430e2 100644 --- a/src/transaction/transaction.controller.ts +++ b/src/transaction/transaction.controller.ts @@ -155,14 +155,13 @@ export class TransactionController { }; } - @Get('check-bill-history/:id') + @Get('check-bill-history') async getCheckBillHistory( @Param('id') id: string, @Request() req, ) { - const data = await this.transactionService.findOne( + const data = await this.transactionService.findAll( req.user.userId, - id, ); return { diff --git a/src/transaction/transaction.service.ts b/src/transaction/transaction.service.ts index d28c023..630e9eb 100644 --- a/src/transaction/transaction.service.ts +++ b/src/transaction/transaction.service.ts @@ -1399,6 +1399,36 @@ export class TransactionService { } } + async findAll(user: string) { + try { + return this.checkBillHistoryRepository.find({ + where: { + user: user, + }, + select: [ + 'amount', + 'admin_price', + 'product_code', + 'destination', + 'trx_id', + 'partner_trx_id', + 'createdAt', + ], + order: { + createdAt: 'DESC', + } + }); + } catch (e) { + throw new HttpException( + { + statusCode: HttpStatus.NOT_FOUND, + error: 'Billing not found', + }, + HttpStatus.NOT_FOUND, + ); + } + } + async topUpHistoryByUser( page: number, user: string,