Browse Source

Only update if amount

pull/1926/head
Thomas 2 years ago
parent
commit
1e7db9488a
  1. 6
      apps/api/src/app/account/account.service.ts

6
apps/api/src/app/account/account.service.ts

@ -185,7 +185,7 @@ export class AccountService {
currency: string;
date: Date;
userId: string;
}): Promise<Account> {
}) {
const { balance, currency: currencyOfAccount } = await this.account({
id_userId: {
userId,
@ -201,7 +201,8 @@ export class AccountService {
date
);
return this.prismaService.account.update({
if (amountInCurrencyOfAccount) {
await this.prismaService.account.update({
data: {
balance: new Big(balance).plus(amountInCurrencyOfAccount).toNumber()
},
@ -214,3 +215,4 @@ export class AccountService {
});
}
}
}

Loading…
Cancel
Save