From 2985f19871e5915a190f5916286d7d42acf35d56 Mon Sep 17 00:00:00 2001 From: Kevsl Date: Sat, 8 Jun 2024 10:14:43 +0200 Subject: [PATCH] fixed quantity substraction --- src/crypto/crypto.service.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/crypto/crypto.service.ts b/src/crypto/crypto.service.ts index 8d0242d..ebbb15d 100644 --- a/src/crypto/crypto.service.ts +++ b/src/crypto/crypto.service.ts @@ -130,12 +130,14 @@ export class CryptoService { value: newCryptoValue, }, }); + const newQuantity = (crypto.quantity -= 1); return this.prisma.crypto.update({ where: { id: dto.id_crypto, }, data: { value: newCryptoValue, + quantity: newQuantity, }, }); }