mirror of
https://github.com/Kevsl/crypto-exchange-api.git
synced 2025-07-09 14:00:12 +02:00
added token sell to bank
This commit is contained in:
parent
fa1bd8b757
commit
19f0778918
@ -105,6 +105,14 @@ export class CryptoService {
|
||||
},
|
||||
});
|
||||
const newBalance = userAsset.amount - dto.amount;
|
||||
await this.prisma.crypto.update({
|
||||
where: {
|
||||
id: dto.id_crypto,
|
||||
},
|
||||
data: {
|
||||
quantity: crypto.quantity + dto.amount,
|
||||
},
|
||||
});
|
||||
if (newBalance > 0) {
|
||||
return this.prisma.userHasCrypto.update({
|
||||
where: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user