added token sell to bank

This commit is contained in:
Kevsl 2024-06-14 13:40:38 +02:00
parent fa1bd8b757
commit 19f0778918

View File

@ -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: {