Merge branch 'master' into 'devops-production'
Master See merge request empatnusabangsa/ppob/ppob-backend!118
This commit is contained in:
commit
1bc8a2264d
|
@ -159,6 +159,29 @@ export class TransactionController {
|
||||||
page,
|
page,
|
||||||
req.user.userId,
|
req.user.userId,
|
||||||
userDestination,
|
userDestination,
|
||||||
|
'detail',
|
||||||
|
pageSize,
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...data,
|
||||||
|
statusCode: HttpStatus.OK,
|
||||||
|
message: 'success',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('history-deposit-profile')
|
||||||
|
async getHistoryDepositUserProfile(
|
||||||
|
@Query('page') page: number,
|
||||||
|
@Query('pageSize') pageSize: number,
|
||||||
|
@Query('user-destination') userDestination: string,
|
||||||
|
@Request() req,
|
||||||
|
) {
|
||||||
|
const data = await this.transactionService.topUpHistoryByUser(
|
||||||
|
page,
|
||||||
|
req.user.userId,
|
||||||
|
userDestination,
|
||||||
|
'profile',
|
||||||
pageSize,
|
pageSize,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1041,18 +1041,48 @@ export class TransactionService {
|
||||||
page: number,
|
page: number,
|
||||||
user: string,
|
user: string,
|
||||||
destinationUser: string,
|
destinationUser: string,
|
||||||
|
type: string,
|
||||||
pageSize?: number,
|
pageSize?: number,
|
||||||
) {
|
) {
|
||||||
|
const userData = await this.userService.findExist(user);
|
||||||
|
|
||||||
const baseQuery = this.transactionRepository
|
const baseQuery = this.transactionRepository
|
||||||
.createQueryBuilder('transaction')
|
.createQueryBuilder('transaction')
|
||||||
.where(
|
.leftJoinAndMapOne(
|
||||||
|
'transaction.userData',
|
||||||
|
UserDetail,
|
||||||
|
'userData',
|
||||||
|
'userData.user = transaction.user',
|
||||||
|
);
|
||||||
|
|
||||||
|
if (
|
||||||
|
userData.roles.name == 'Admin' ||
|
||||||
|
userData.roles.name == 'Customer Service' ||
|
||||||
|
type == 'profile'
|
||||||
|
) {
|
||||||
|
baseQuery.where(
|
||||||
|
'transaction.type = 0 and transaction.user_destination = :destinationId',
|
||||||
|
{
|
||||||
|
destinationId: destinationUser,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
baseQuery.where(
|
||||||
'transaction.user = :id and transaction.type = 0 and transaction.user_destination = :destinationId',
|
'transaction.user = :id and transaction.type = 0 and transaction.user_destination = :destinationId',
|
||||||
{
|
{
|
||||||
id: user,
|
id: user,
|
||||||
destinationId: destinationUser,
|
destinationId: destinationUser,
|
||||||
},
|
},
|
||||||
)
|
);
|
||||||
.select(['id', 'created_at as transaction_date', 'amount'])
|
}
|
||||||
|
|
||||||
|
baseQuery
|
||||||
|
.select([
|
||||||
|
'transaction.id',
|
||||||
|
'transaction.created_at as transaction_date',
|
||||||
|
'amount',
|
||||||
|
'userData.name as sender_name',
|
||||||
|
])
|
||||||
.orderBy('transaction.created_at', 'DESC');
|
.orderBy('transaction.created_at', 'DESC');
|
||||||
|
|
||||||
const data = await baseQuery
|
const data = await baseQuery
|
||||||
|
|
Loading…
Reference in New Issue
Block a user