Merge branch 'development' of https://gitlab.com/empatnusabangsa/ppob/ppob-backend into devops-staging

This commit is contained in:
Muhammad Fadli 2023-05-09 14:46:02 +07:00
commit 288749336f
2 changed files with 13 additions and 1 deletions

View File

@ -185,6 +185,7 @@ export class TransactionController {
@Query('pageSize') pageSize: number, @Query('pageSize') pageSize: number,
@Query('start') startDate: string, @Query('start') startDate: string,
@Query('end') endDate: string, @Query('end') endDate: string,
@Query('trxId') trxId: string,
@Request() req, @Request() req,
) { ) {
const data = await this.transactionService.transactionHistoryByUser( const data = await this.transactionService.transactionHistoryByUser(
@ -192,6 +193,7 @@ export class TransactionController {
req.user.userId, req.user.userId,
startDate == 'null' ? null : startDate, startDate == 'null' ? null : startDate,
endDate == 'null' ? null : endDate, endDate == 'null' ? null : endDate,
trxId == 'null' ? null : trxId,
pageSize, pageSize,
); );
@ -229,6 +231,7 @@ export class TransactionController {
@Query('pageSize') pageSize: number, @Query('pageSize') pageSize: number,
@Query('start') startDate: string, @Query('start') startDate: string,
@Query('end') endDate: string, @Query('end') endDate: string,
@Query('trxId') trxId: string,
@Param('id', ParseUUIDPipe) id: string, @Param('id', ParseUUIDPipe) id: string,
) { ) {
const data = await this.transactionService.transactionHistoryByUser( const data = await this.transactionService.transactionHistoryByUser(
@ -236,6 +239,7 @@ export class TransactionController {
id, id,
startDate == 'null' ? null : startDate, startDate == 'null' ? null : startDate,
endDate == 'null' ? null : endDate, endDate == 'null' ? null : endDate,
trxId == 'null' ? null : trxId,
pageSize, pageSize,
); );

View File

@ -1885,6 +1885,7 @@ export class TransactionService {
user: string, user: string,
startDate: string, startDate: string,
endDate: string, endDate: string,
trxId: string,
pageSize?: number, pageSize?: number,
) { ) {
const userData = await this.userService.findExist(user); const userData = await this.userService.findExist(user);
@ -1950,7 +1951,7 @@ export class TransactionService {
.addSelect('supplier.name', 'supplier_name') .addSelect('supplier.name', 'supplier_name')
.orderBy('transaction.created_at', 'DESC'); .orderBy('transaction.created_at', 'DESC');
if (startDate && endDate) { if (startDate != null && endDate != null) {
baseQuery.andWhere( baseQuery.andWhere(
'transaction.created_at between :startDate and :enDate', 'transaction.created_at between :startDate and :enDate',
{ {
@ -1958,6 +1959,13 @@ export class TransactionService {
enDate: new Date(endDate), enDate: new Date(endDate),
}, },
); );
} else if (trxId != null) {
baseQuery.andWhere(
'transaction.supplier_trx_id = :trxId',
{
trxId: trxId
},
);
} }
const data = await baseQuery const data = await baseQuery