This commit is contained in:
@@ -262,7 +262,7 @@ export class WalletsService {
|
|||||||
const wallet = await queryRunner.manager.findOne(Wallet, { where: { user: { id: userId } }, lock: { mode: "pessimistic_write" } });
|
const wallet = await queryRunner.manager.findOne(Wallet, { where: { user: { id: userId } }, lock: { mode: "pessimistic_write" } });
|
||||||
if (!wallet) throw new BadRequestException(WalletMessage.WALLET_NOT_FOUND);
|
if (!wallet) throw new BadRequestException(WalletMessage.WALLET_NOT_FOUND);
|
||||||
|
|
||||||
if (wallet.balance.lessThan(amount)) {
|
if (new Decimal(wallet.balance).lessThan(amount)) {
|
||||||
throw new BadRequestException(WalletMessage.BALANCE_IS_NOT_ENOUGH)
|
throw new BadRequestException(WalletMessage.BALANCE_IS_NOT_ENOUGH)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user