fix: transaction order product
This commit is contained in:
@@ -310,9 +310,6 @@ export class UsersService {
|
||||
}
|
||||
|
||||
async findOne(id: string) {
|
||||
const coa = await this.coaService.findByUser(id, coaType.WALLET);
|
||||
const coaProfit = await this.coaService.findByUser(id, coaType.PROFIT);
|
||||
|
||||
try {
|
||||
const userData = await this.usersRepository
|
||||
.createQueryBuilder('users')
|
||||
@@ -336,11 +333,17 @@ export class UsersService {
|
||||
'userDetail.phone_number',
|
||||
])
|
||||
.getOne();
|
||||
const coa = await this.coaService.findByUser(id, coaType.WALLET);
|
||||
let coaProfit;
|
||||
if(userData.roles.id != 'e4dfb6a3-2338-464a-8fb8-5cbc089d4209'){
|
||||
coaProfit = await this.coaService.findByUser(id, coaType.PROFIT);
|
||||
};
|
||||
|
||||
|
||||
return {
|
||||
...userData,
|
||||
wallet: coa.amount,
|
||||
profit: coaProfit.amount,
|
||||
profit: coaProfit ? coaProfit.amount : coaProfit,
|
||||
};
|
||||
} catch (e) {
|
||||
if (e instanceof EntityNotFoundError) {
|
||||
|
||||
Reference in New Issue
Block a user