From 19f07789186311bba6575f3dcd5a4c8e4e1f65b5 Mon Sep 17 00:00:00 2001 From: Kevsl Date: Fri, 14 Jun 2024 13:40:38 +0200 Subject: [PATCH] added token sell to bank --- src/crypto/crypto.service.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/crypto/crypto.service.ts b/src/crypto/crypto.service.ts index ef9c67d..9196390 100644 --- a/src/crypto/crypto.service.ts +++ b/src/crypto/crypto.service.ts @@ -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: {