diff --git a/apps/api/src/app/account/account.service.ts b/apps/api/src/app/account/account.service.ts index e06ea69fd..c6da815e4 100644 --- a/apps/api/src/app/account/account.service.ts +++ b/apps/api/src/app/account/account.service.ts @@ -185,7 +185,7 @@ export class AccountService { currency: string; date: Date; userId: string; - }): Promise { + }) { const { balance, currency: currencyOfAccount } = await this.account({ id_userId: { userId, @@ -201,16 +201,18 @@ export class AccountService { date ); - return this.prismaService.account.update({ - data: { - balance: new Big(balance).plus(amountInCurrencyOfAccount).toNumber() - }, - where: { - id_userId: { - userId, - id: accountId + if (amountInCurrencyOfAccount) { + await this.prismaService.account.update({ + data: { + balance: new Big(balance).plus(amountInCurrencyOfAccount).toNumber() + }, + where: { + id_userId: { + userId, + id: accountId + } } - } - }); + }); + } } }