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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
7 additions and
10 deletions
-
CHANGELOG.md
-
apps/api/src/app/account-balance/account-balance.service.ts
|
|
|
@ -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 |
|
|
|
|
|
|
|
@ -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 |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|