Browse Source

Bugfix/race condition in upsert of account balance (#8306)

* Fix race condition in upsert of account balance

* Update changelog
pull/8311/head^2
Thomas Kaul 3 days ago
committed by GitHub
parent
commit
1de6f660c1
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 16
      apps/api/src/app/account-balance/account-balance.service.ts

1
CHANGELOG.md

@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed a race condition in the creation of an account balance
- Fixed the handling of an output of the model which does not agree with the schema in the import of activities with _Ghostfolio AI_ (experimental)
## 3.92.0 - 2026-10-24

16
apps/api/src/app/account-balance/account-balance.service.ts

@ -51,17 +51,13 @@ export class AccountBalanceService {
}: CreateAccountBalanceDto & {
userId: string;
}): Promise<AccountBalance> {
const dateOfBalance = resetHours(parseISO(date));
const accountBalance = await this.prismaService.accountBalance.upsert({
create: {
account: {
connect: {
id_userId: {
userId,
id: accountId
}
}
},
date: resetHours(parseISO(date)),
accountId,
userId,
date: dateOfBalance,
value: balance
},
update: {
@ -71,7 +67,7 @@ export class AccountBalanceService {
accountId_userId_date: {
accountId,
userId,
date: resetHours(parseISO(date))
date: dateOfBalance
}
}
});

Loading…
Cancel
Save