add: history-deposit-profile
This commit is contained in:
@@ -1041,18 +1041,48 @@ export class TransactionService {
|
||||
page: number,
|
||||
user: string,
|
||||
destinationUser: string,
|
||||
type: string,
|
||||
pageSize?: number,
|
||||
) {
|
||||
const userData = await this.userService.findExist(user);
|
||||
|
||||
const baseQuery = this.transactionRepository
|
||||
.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',
|
||||
{
|
||||
id: user,
|
||||
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');
|
||||
|
||||
const data = await baseQuery
|
||||
|
||||
Reference in New Issue
Block a user